提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
最小增加一倍
import java.text.ChoiceFormat; public class Main { public static void main(String[] argv) throws Exception { /**来自 NowJava.com - 时 代 Java**/ double d = 1.2; // Get the largest double less than d double d1 = ChoiceFormat.previousDouble(d); // 1.1999999999999997 System.out.println(d1); // Get the smallest double greater than d double d2 = ChoiceFormat.nextDouble(d); // 1.2000000000000002 System.out.println(d2); } }