Here you can find the source of isFinite(Duration duration)
public static boolean isFinite(Duration duration)
//package com.java2s; //License from project: Open Source License import java.time.Duration; import java.time.temporal.ChronoUnit; public class Main { public static final Duration INF_POSITIVE = ChronoUnit.FOREVER.getDuration(); public static final Duration INF_NEGATIVE = INF_POSITIVE.negated(); public static boolean isFinite(Duration duration) { return !isInfPositive(duration) && !isInfNegative(duration); }/*from ww w.j av a 2s. com*/ public static boolean isInfPositive(Duration duration) { return INF_POSITIVE.equals(duration); } public static boolean isInfNegative(Duration duration) { return INF_NEGATIVE.equals(duration); } }