public static String divide ( String dividend , String divisor , int scale ) { BigDecimal bdDividend ; BigDecimal bdDivisor ; try { bdDividend = new BigDecimal ( dividend ) ; bdDivisor = new BigDecimal ( divisor ) ; return bdDividend . divide ( bdDivisor , scale , RoundingMode . HALF_UP ) . toString ( ) ; } catch ( Exception e ) { return null ; } }
Get the result of dividend divided by divisor with given scale .