Here you can find the source of roundTimestampToNexDay(long timestamp)
public static final long roundTimestampToNexDay(long timestamp)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { public static final long roundTimestampToNexDay(long timestamp) { return roundTimestampToDay(timestamp) + TimeUnit.DAYS.toMillis(1); }/*from www. j a v a2 s .c om*/ public static final long roundTimestampToDay(long timestamp) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date(timestamp)); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTimeInMillis(); } }