Here you can find the source of divide(String num1, String num2, int scale)
public static String divide(String num1, String num2, int scale)
//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(); } }