import java.sql.Timestamp;

class Main {
  private static long MintueToMillis(int m) {
    return m * 60000;
  }

  // DBからとってくる値
  private static int getIntervalMin() {
    return 5;
  }

  public static boolean isStoppable(Timestamp ts1, Timestamp ts2) {
    long diff = ts2.getTime() - ts1.getTime();
    return !(diff >= 0 && diff <= MintueToMillis(getIntervalMin()));
  }

  public static void main(String args[]) {
    Timestamp now  = new Timestamp(System.currentTimeMillis());
    Timestamp next1 = new Timestamp(now.getTime() + MintueToMillis(1));  // 1分後
    Timestamp next2 = new Timestamp(now.getTime() + MintueToMillis(6));  // 6分後

    System.out.println("now: " + now.toString());
    System.out.println(next1.toString() + " -> stoppable: " + isStoppable(now, next1));
    System.out.println(next2.toString() + " -> stoppable: " + isStoppable(now, next2));
  }
}