java - Unable to loop for different data -
i unable loop through database timelist output different time require. loop through first 1 , display same data every output require. if close loop of of conversion, have problem displaying in output statement.
string[] timeminute = timelist .split("<split>"); (int t = 0; t <timeminute.length; t ++) { string strdate = timelist; simpledateformat sdf = new simpledateformat("yyyymmddhhmmss"); date getdate = sdf.parse(strdate); calendar calendar = calendar.getinstance(); calendar.settime(getdate); int noofhours = calendar.get(calendar.hour_of_day); int noofminutes = calendar.get(calendar.minute); int totalminutes = noofhours * 60 + noofminutes; while ( rs.next() ) { string rtd= rs.getstring("rtd"); if ( !trd1.contains( rtd) ) trd1.add(rtd); string admissioncount = ""; if ( rs.getstring("jae") != null ) admission = rs.getstring("jae"); string[] admissioncount = admission.split("<split>"); ( int = 0 ; <gateno.length ; ++ ) { if ( kpm.containskey(gateno[i]) ) kpm.get(admissioncount [i]).put(rtd, + totalminutes); } } ( int = 0 ; < .size(); i++) { stringwriter.append( trd1.get(i) + ","); ( string admissioncount : kpm.keyset() ) { if ( kpm.get(admissioncount ).containskey(trd1.get(i) ) ) mso.get(admissioncount ).append(totalminutes +","); else mso.get(admissioncount ).append("0,"); } }
the current output example -
data1,0,56,0 data2,56,0,0 data3,56,0,0 data4,0,0,56
desire output example -
data1,0,87,0 data2,56,0,0 data3,43,0,0 data4,0,0,91
edit:
for ( string egm : .keyset() ) resultstring += system.getproperty("line.separator") + gate + "," + mso.get(egm).tostring();