Here you can find the source of areFloatsEqual(float f1, float f2)
public static boolean areFloatsEqual(float f1, float f2)
//package com.java2s; //License from project: GNU General Public License public class Main { /**//from w w w .j av a 2 s . c o m * used to compare two floats which are tested for having (almost) the same value */ public static boolean areFloatsEqual(float f1, float f2) { return areFloatsEqual(f1, f2, 0.001F); } public static boolean areFloatsEqual(float f1, float f2, float maxDifference) { return Math.abs(f1 - f2) < maxDifference; } }