Java Math BigDecimal.valueOf(long val) 方法 Java Math BigDecimal.valueOf(double val) 方法 Java Math BigDecimal.valueOf(long unscaledVal, int scale) Java Math BigDecimal.valueOf(long val) 方法 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 // static method is called using class name bg = BigDecimal.valueOf(l); String str = "The Long After Conversion to BigDecimal is " + bg; // print bg value System.out.println( str ); } } Java Math BigDecimal.valueOf(double val) 方法 Java Math BigDecimal.valueOf(long unscaledVal, int scale)