package com.moral.util; import java.util.HashMap; import java.util.Map; public class TempAllocationUtils { public static Map tempAllocation(Map map){ Map tempMap = new HashMap<>(); Double tempDay = Double.parseDouble(map.get("tempDay").toString()); Double tempNight = Double.parseDouble(map.get("tempNight").toString()); Double time5 = tempNight; Double time13 = tempDay; Double difference = tempDay-tempNight; Double dif_8 = difference/8; Double dif_16 = difference/16; tempMap.put("5", time5); tempMap.put("13", time13); String time = null; Double t = time5; for(int i=4;i>=0;i--) { time = ""+i; t = t+dif_16; String tempLast = ""+Math.round(t); tempMap.put(time, tempLast); } Double y = time5; for(int i=6;i<13;i++) { time = ""+i; y = y+dif_8; String tempLast = ""+Math.round(y); tempMap.put(time, tempLast); } Double z = time13; for(int i=14;i<=23;i++) { time = ""+i; z = z-dif_16; String tempLast = ""+Math.round(z); tempMap.put(time, tempLast); } return tempMap; } }