Chen08

    技术2022-07-11  86

    [Calendar] 实例化Calendar Calendar c = Calendar.getInstance(); 月份是从0开始计数的(0-11)

    c.set();//日历设置到某一天 c.get();//日历翻到的那一天

    BigInteger 表示整数、 BigDecimal表示浮点数 对于输出浮点数保留几位小数的问题,可以使用DecimalFormat类,

    DecimalFormat f = new DecimalFormat("#.00#"); DecimalFormat g = new DecimalFormat("0.000"); double a = 123.45678, b = 0.12; System.out.println(f.format(a)); System.out.println(f.format(b)); System.out.println(g.format(b));

    0指一位数字,#指除0以外的数字

    大数用法:不能直接用运算符使用大数字

    BigInteger a = BigInteger.valueOf(100); BigInteger b = BigInteger.valueOf(50); BigInteger c = a.add(b) // c = a + b;

    常用方法:

    BigInteger add() BigInteger subtract() BigInteger multiply() BigInteger divide() BigInteger mod() int compareTo() static BigInteger valueOf()
    Processed: 0.011, SQL: 9