Java Double Number Divide divide(String num1, String num2, int scale)

Here you can find the source of divide(String num1, String num2, int scale)

Description

divide

License

Apache License

Declaration

public static String divide(String num1, String num2, int scale) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {

    public static String divide(String num1, String num2) {
        return divide(num1, num2, 2);
    }//from www  .  j a  v a2  s  .  c  o  m

    public static String divide(String num1, String num2, int scale) {
        BigDecimal dec1 = new BigDecimal(num1);
        BigDecimal dec2 = new BigDecimal(num2);
        return dec1.divide(dec2, scale, BigDecimal.ROUND_HALF_UP)
                .toString();
    }
}

Related

  1. divide(Number numerator, Number denominator)
  2. divide(Object dividend, Object divisor)
  3. divide(Object num1, Object num2)
  4. divide(String num1, String num2)
  5. divide(String num1, String num2, int scale)
  6. divide(String thisVal, String addVal)
  7. divide4Money(Double value1, Double value2)
  8. divideComplex(double realOne, double imagOne, double realTwo, double imagTwo)
  9. divideDouble(double first, double second)