code: public static BigInteger numericStringToBigInteger(String numeric, boolean round) {
          BigDecimal decimal;
  
          try {
              decimal = new BigDecimal(numeric);
          } catch (Exception ex) {
              return null;
          }
  
          if (round) {
              decimal = decimal.setScale(0, BigDecimal.ROUND_HALF_UP);
          }
          BigInteger integer = decimal.toBigInteger();
          return integer;
      }
docs: Converts a numeric string to a {@code BigInteger}.
  
  This function first converts to a {@code BigDecimal} to make sure the
  base number being used is accurate. If {@code round} is set to
  <strong>true</strong> this method uses the {@code ROUND_HALF_UP} rounding
  method from {@code BigDecimal}. Otherwise the decimal part is dropped. If
  the string cannot be converted, this method returns {@code null}
  
  @param numeric A numeric string (with or without decimals).
  @param round Use {@link BigDecimal#ROUND_HALF_UP} method.
  
  @return {@code BigInteger} representation of the string or {@code null}
  
  @see BigDecimal