Here you can find the source of createJsonNumber(BigDecimal d)
public static JsonNumber createJsonNumber(BigDecimal d)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.BigInteger; import javax.json.JsonNumber; import javax.json.JsonValue; public class Main { public static JsonNumber createJsonNumber(BigDecimal d) { return new JsonNumber() { @Override/*from ww w . j a v a 2 s .c o m*/ public boolean isIntegral() { return d.scale() == 0; } @Override public int intValue() { return d.intValue(); } @Override public int intValueExact() { return d.intValueExact(); } @Override public long longValue() { return d.longValue(); } @Override public long longValueExact() { return d.longValueExact(); } @Override public BigInteger bigIntegerValue() { return d.toBigInteger(); } @Override public BigInteger bigIntegerValueExact() { return d.toBigIntegerExact(); } @Override public double doubleValue() { return d.doubleValue(); } @Override public BigDecimal bigDecimalValue() { return d; } @Override public JsonValue.ValueType getValueType() { return ValueType.NUMBER; } }; } }