import java.sql.Timestamp;
class Main {
private static long MintueToMillis(int m) {
return m * 60000;
}
// DBからとってくる値
private static int getIntervalMin() {
return 5;
}
long diff = ts2.getTime() - ts1.getTime();
return !(diff >= 0 && diff <= MintueToMillis(getIntervalMin()));
}
public static void main
(String args
[]) {
System.
out.
println("now: " + now.
toString()); System.
out.
println(next1.
toString() + " -> stoppable: " + isStoppable
(now, next1
)); System.
out.
println(next2.
toString() + " -> stoppable: " + isStoppable
(now, next2
)); }
}
aW1wb3J0IGphdmEuc3FsLlRpbWVzdGFtcDsKCmNsYXNzIE1haW4gewogIHByaXZhdGUgc3RhdGljIGxvbmcgTWludHVlVG9NaWxsaXMoaW50IG0pIHsKICAgIHJldHVybiBtICogNjAwMDA7CiAgfQoKICAvLyBEQuOBi+OCieOBqOOBo+OBpuOBj+OCi+WApAogIHByaXZhdGUgc3RhdGljIGludCBnZXRJbnRlcnZhbE1pbigpIHsKICAgIHJldHVybiA1OwogIH0KCiAgcHVibGljIHN0YXRpYyBib29sZWFuIGlzU3RvcHBhYmxlKFRpbWVzdGFtcCB0czEsIFRpbWVzdGFtcCB0czIpIHsKICAgIGxvbmcgZGlmZiA9IHRzMi5nZXRUaW1lKCkgLSB0czEuZ2V0VGltZSgpOwogICAgcmV0dXJuICEoZGlmZiA+PSAwICYmIGRpZmYgPD0gTWludHVlVG9NaWxsaXMoZ2V0SW50ZXJ2YWxNaW4oKSkpOwogIH0KCiAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nIGFyZ3NbXSkgewogICAgVGltZXN0YW1wIG5vdyAgPSBuZXcgVGltZXN0YW1wKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKICAgIFRpbWVzdGFtcCBuZXh0MSA9IG5ldyBUaW1lc3RhbXAobm93LmdldFRpbWUoKSArIE1pbnR1ZVRvTWlsbGlzKDEpKTsgIC8vIDHliIblvowKICAgIFRpbWVzdGFtcCBuZXh0MiA9IG5ldyBUaW1lc3RhbXAobm93Lmdld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