Here you can find the source of convertDouble(double damage)
Parameter | Description |
---|---|
damage | the amount of damage to convert. |
public static String convertDouble(double damage)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { /**//from w w w.j av a 2 s . co m * Convert endless decimal health to a 2 lengthed one. * * @param damage the amount of damage to convert. * @return The new damage amount with 2 lenghted decimal. */ public static String convertDouble(double damage) { NumberFormat nf = new DecimalFormat("##.##"); return nf.format(damage); } }