Cuts down necessary decimal points from the given Double value i.e. - Android Graphics

Android examples for Graphics:Path Point

Description

Cuts down necessary decimal points from the given Double value i.e.

Demo Code


//package com.java2s;

import java.text.DecimalFormat;

public class Main {
    /**// w w  w . j  av a2s.  c o m
     * Cuts down necessary decimal points from the given Double value
     * <br> i.e. 12.102342 -> 12.1023
     */
    public static String getPrettyDecimal(Double value) {
        DecimalFormat number_format = new java.text.DecimalFormat("#.####");
        return number_format.format(value);
    }
}

Related Tutorials