将下标从一个数组匹配到另一个数组

时间:2015-09-19 21:18:36

标签: java arrays

我对数组有这个问题。也许我以一种奇怪的方式接近这个,你们让我知道。我有两个数组:

String[] months = {"January","February","March","April","May",
                   "June","July","August","September",
                   "October","November","December"};
double[] rainfall ={4.22, 3.18, 3.03, 3.52, 4.54, 5.55, 
                    4.71, 4.35, 5.26, 5.46, 4.78, 4.09};

这些数字代表降雨量。我运行算法从double[]降雨中找到最多和最少的,它给了我3.03,这是3月。 我的问题是,如何将该下标与数组String[]个月的下标相关联,以便它显示月份的名称? 我应该制作堆叠阵列吗?

0 个答案:

没有答案