Java Math BigDecimal.valueOf(long unscaledVal, int scale) Java Math BigDecimal.valueOf(long val) 方法 Java Math BigInteger.abs() 方法 Java Math BigDecimal.valueOf(long unscaledVal, int scale) package com.codingdict; import java.math.*; public class BigDecimalDemo { public static void main(String[] args) { // create a BigDecimal object BigDecimal bg; // create a Long Object Long l = new Long("12345678"); // assign the bigdecimal value of l to bg // scale is 4 bg = BigDecimal.valueOf(l, 4); String str = "The Value of BigDecimal using scale 4 is " + bg; // print bg value System.out.println( str ); } } Java Math BigDecimal.valueOf(long val) 方法 Java Math BigInteger.abs() 方法