Code example for BigDecimal

Methods: toPlainString

    public static String formatToSignificant(double value,
            int significant)
            MathContext mathContext = new MathContext(significant,
            BigDecimal bigDecimal = new BigDecimal(value,
            return bigDecimal.toPlainString();
     * The "standard" method for rounding 
     * @param value The value to round 
     * @return String containing the rounded value 
    private static String round(double value) {
        return formatToSignificant(value, SF);
Stop searching for code, let great code find you!  Add Codota to your java IDE