Here you can find the source of getMillisecondsUntilNextMinute()
public static int getMillisecondsUntilNextMinute()
//package com.java2s; import java.util.Calendar; public class Main { public static final int MINUTE_IN_MILLISECONDS = 60000; public static int getMillisecondsUntilNextMinute() { Calendar c = Calendar.getInstance(); long ms = c.getTimeInMillis(); long nextminute = (ms + (MINUTE_IN_MILLISECONDS - 1)) / MINUTE_IN_MILLISECONDS * MINUTE_IN_MILLISECONDS; int result = (int) (nextminute - ms); return result; }/* w w w . j av a2 s . com*/ }