使用Float对象的compareTo()方法比较浮点值。
Float float1 = new Float("9.6175"); /** from 时代Java - nowjava.com**/ Float float2 = new Float("7.38126"); Float float3 = new Float("2347.373"); System.out.println(float1.compareTo(float3)); System.out.println(float2.compareTo(float3)); System.out.println(float1.compareTo(float1)); System.out.println(float3.compareTo(float2));