code: static Object convert(Object object, Class<?> otherType) {
  
      if (otherType == BigDecimal.class) {
        if (object instanceof BigInteger) {
          return new BigDecimal((BigInteger) object);
        } else if (object instanceof Number) {
          return BigDecimal.valueOf(((Number) object).doubleValue());
        }
      } else if (otherType == BigInteger.class) {
        if (!(object instanceof BigDecimal) && (object instanceof Number)) {
          return BigInteger.valueOf(((Number) object).longValue());
        }
      }
      return object;
    }
docs: This method converts the given value to a more common type.
  
  @param object is the value to convert.
  @param otherType the type of the value to compare that differs from the type
  @return a simpler representation of {@code value} or the same {@code value} if on simpler type
  is known.