code: public static String divide(String dividend, String divisor) {
          try {
              BigDecimal bdDividend = new BigDecimal(dividend);
              BigDecimal bdDivisor = new BigDecimal(divisor);
              try {
                  return bdDividend.divide(bdDivisor).toString();
              } catch (ArithmeticException ae) {
                  int scale = Math.max(bdDividend.scale(), bdDivisor.scale()) + 1;
                  return divide(dividend, divisor, scale);
              }
          } catch (Exception ex) {
              return null;
          }
      }
docs: Get the result of dividend divided by divisor. When the result is
  indivisible, the scale will depends on the scale of dividend and divisor.
  
  Any numeric string recognized by {@code BigDecimal} is supported.
  
  @param dividend A valid number string
  @param divisor A valid number strings
  
  @return <code>dividend / divisor</code>
  
  @see BigDecimal