Here you can find the source of getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay)
public static Date getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.util.Calendar; import java.util.Date; public class Main { public static final BigDecimal MAN_DAY = new BigDecimal("0.5"); public static Date getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay) { if (serviceStartTime == null) { return null; }/* w w w . ja va 2 s .c om*/ Calendar startTime = Calendar.getInstance(); startTime.setTime(serviceStartTime); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.SECOND, 0); startTime.set(Calendar.MILLISECOND, 0); int startHour = startTime.get(Calendar.HOUR_OF_DAY); if (startHour >= 12) { startTime.set(Calendar.HOUR_OF_DAY, 12); } else { startTime.set(Calendar.HOUR_OF_DAY, 0); } int hourAdd = (manDay.divide(MAN_DAY).intValue()) * 12; startTime.add(Calendar.HOUR_OF_DAY, hourAdd); return startTime.getTime(); } }