public class Counter { public static void main(String[] args) { float[] array={3000,2500,2000,1500,1000,500,300,200,125,110,100,95,85,80,75,60, 50, 40, 30, 20, 10, 5,4,3,2,1,.75F, .6F, .55F, .5F}; for (float element : array){ int phases=-1; float ms=0.000000F; double heatUpChunk =0.00D; boolean wireBroken=false; float wiredec = 0.00000F; float Ton = element; float Toff =Ton; float Timetoheatup=2846; float timeToCoolDown=1.73548440F*Timetoheatup; heatUpChunk = (element/1000); while (!wireBroken){ ms=0; for (int i = 0; i<1000; i++){ wiredec+=((Ton/(Timetoheatup))/1000);//heat up wireBroken=(wiredec >= 1.0F); if (!wireBroken) ms+=heatUpChunk; } wiredec-=(Toff/(timeToCoolDown)); wireBroken=(wiredec >= 1.0F) || wireBroken; phases++; } System.out.print ("T_on(mS)-" + (element) ); System.out.println(" - " + ((phases*Ton*2/1000)+(ms/1000)) + " seconds"); } } }