Here you can find the source of formatPercentage(double percentage)
public static String formatPercentage(double percentage)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static NumberFormat percentageFormatter; public static String formatPercentage(double percentage) { if (percentageFormatter == null) { percentageFormatter = new DecimalFormat("#0.0%"); }// ww w . ja v a2s . co m return percentageFormatter.format(percentage); } }