Here you can find the source of doubleToBoolean(double value)
public static boolean doubleToBoolean(double value)
//package com.java2s; //License from project: Apache License public class Main { public static final double epsilon = .0001; public static boolean doubleToBoolean(double value) { if (Math.abs(1 - value) < epsilon) { return true; } else if (Math.abs(value) < epsilon) { return false; } else// w w w.ja v a 2 s . c o m throw new RuntimeException( "Failed to convert to boolean, not near zero or one: " + value); } }