Description Of BigDecimal: valueOf(long unscaledVal, int scale)
The java.math.BigDecimal.valueOf(long unscaledVal, int scale) translates a long unscaled value and an int scale into a BigDecimal . This "static factory method" is provided in preference to a ( long , int ) constructor because it allows for reuse of frequently used BigDecimal values.BigDecimal.valueOf(long unscaledVal, int scale) method returns a BigDecimal whose value is (unscaledVal ? 10-scale).
Code Example Java BigDecimal
import java.math.BigDecimal; public class BigDecimalExam { public static void main(String[] args) { Long d = new Long("123"); BigDecimal bg = BigDecimal.valueOf(d, 4); System.out.println(bg); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น