Code example for BigInteger

Methods: compareTo, longValue

0
   */ 
  @Override 
  Object getAsObject() {
    if (value instanceof BigInteger) {
      BigInteger big = (BigInteger) value;
      if (big.compareTo(INTEGER_MAX) < 0) {
        return big.intValue();
      } else if (big.compareTo(LONG_MAX) < 0) {
        return big.longValue();
      } 
    } 
    // No need to convert to float or double since those lose precision 
    return value;
  } 
 
  @Override 
  protected void toString(Appendable sb, Escaper escaper) throws IOException {
    if (isString()) {
      sb.append('"');
      sb.append(escaper.escapeJsonString(value.toString()));
      sb.append('"');