Here you can find the source of getRatioString(double n, double d)
public static String getRatioString(double n, double d)
//package com.java2s; /**// w ww . ja va 2 s .c o m * PureInfo QuakeCenter * @(#)MyTabeleDataHelper.java 1.0 2005-12-1 * * Copyright(c) 2004-2005, PureInfo Information Technology Corp. Ltd. * All rights reserved, see the license file. * * www.pureinfo.com.cn */ import java.text.DecimalFormat; public class Main { public static String getRatioString(double n, double d) { if (d < 0.0001) { return "----"; } DecimalFormat format = new DecimalFormat("#0.0%"); return format.format(n / d); } }