format Double Percent - Java java.lang

Java examples for java.lang:double Format

Description

format Double Percent

Demo Code


//package com.java2s;
import java.text.NumberFormat;

public class Main {

    public static String formatDoublePercent(double rate) {
        NumberFormat format = NumberFormat.getPercentInstance();
        format.setMinimumFractionDigits(2);
        String result = format.format(rate);
        return result;
    }// w w  w  . ja va  2s .c  o  m
}

Related Tutorials