code: @SuppressWarnings("unchecked")
      private static <D extends Number> D getJavaMaxInclusive(Class < D > clazz,
              int totalDigits, int fractionDigits) {
          int dec = totalDigits - fractionDigits;
          char[] decPart = new char[dec];
          Arrays.fill(decPart, '9');
          StringBuilder sb = new StringBuilder();
          sb.append(decPart);
          if (clazz.equals(Short.class)) {
              return (D) (dec > 4 ? Short.valueOf(Short.MAX_VALUE) : Short
                      .valueOf(sb.toString()));
          } else if (clazz.equals(Integer.class)) {
              return (D) (dec > 9 ? Integer.valueOf(Integer.MAX_VALUE) : Integer
                      .valueOf(sb.toString()));
          } else if (clazz.equals(Long.class)) {
              return (D) (dec > 18 ? Long.valueOf(Long.MAX_VALUE) : Long
                      .valueOf(sb.toString()));
          } else if (clazz.equals(BigInteger.class)) {
              return (D) new BigInteger(sb.toString());
          } else if (clazz.equals(BigDecimal.class)) {
              if (fractionDigits > 0) {
                  sb.append(JAVA_DECIMAL_POINT);
                  char[] fracPart = new char[fractionDigits];
                  Arrays.fill(fracPart, '9');
                  sb.append(fracPart);
              }
              return (D) new BigDecimal(sb.toString());
  
          } else {
              throw new IllegalArgumentException("Unsupported java type " + clazz);
          }
  
      }
docs: Determines the maximum value a numeric can take.
  <p/>
  The maximum is constrained either from the host side by the the number of
  digits in the picture clause or by the mapping java type maximum value
  whichever is smaller.
  
  @param clazz the target java numeric type
  @param totalDigits the host total number of digits
  @param fractionDigits the host fractional number of digits
  @return the maximum value this java numeric can take