Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { private static long delayToNextMinute() { Date now = new Date(); long sec = Calendar.getInstance().get(Calendar.SECOND); return now.getTime() - sec * 1000 + 61 * 1000; } }