Hello Seetharam,
You can do something like this
HashMap map=new HashMap();
double[] month_with_data_swap=new double[10];
final int noOfMonths = 12; //ur index of months[i]
for(int i =0; i<noOfMonths; i++) {
//values from database
compoffadded1+=Double.valueOf(rs.getString("comoffadded")).doubleValue();
leavetaken1+=Double.valueOf(rs.getString("leavetaken")).doubleValue();
compoffinhand1=Double.valueOf(rs.getString("compoffinhand")).doubleValue();
leaveinhand1=Double.valueOf(rs.getString("leaveinhand")).doubleValue();
balance1=Double.valueOf(rs.getString("balance")).doubleValue();
month_with_data_swap[0]=compoffadded1;
month_with_data_swap[1]=leavetaken1;
month_with_data_swap[2]=compoffinhand1;
month_with_data_swap[3]=leaveinhand1;
month_with_data_swap[4]=balance1;
map.put("months"+(i+1), month_with_data_swap); //Keys will be "months1", "months2",etc.
}
Later to retrieve the values or modify it, you can use
for(int i =0; i<noOfMonths; i++) {
(typecast it as per your processing logic)map.get("months" + (i+1));
}
Dear Rob, thanks for the explanation. I learnt something new today

[ April 22, 2008: Message edited by: yashbir sachdev ]