List of usage examples for java.text NumberFormat setMinimumFractionDigits
public void setMinimumFractionDigits(int newValue)
From source file:lineage2.gameserver.handler.admincommands.impl.AdminEditChar.java
/** * Method showCharacterList.//ww w . j ava 2 s . c om * @param activeChar Player * @param player Player */ public static void showCharacterList(Player activeChar, Player player) { if (player == null) { GameObject target = activeChar.getTarget(); if ((target != null) && target.isPlayer()) { player = (Player) target; } else { return; } } else { activeChar.setTarget(player); } String clanName = "No Clan"; if (player.getClan() != null) { clanName = player.getClan().getName() + "/" + player.getClan().getLevel(); } NumberFormat df = NumberFormat.getNumberInstance(Locale.ENGLISH); df.setMaximumFractionDigits(4); df.setMinimumFractionDigits(1); NpcHtmlMessage adminReply = new NpcHtmlMessage(5); StringBuilder replyMSG = new StringBuilder("<html><body>"); replyMSG.append("<table width=260><tr>"); replyMSG.append( "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append("<td width=180><center>Character Selection Menu</center></td>"); replyMSG.append( "<td width=40><button value=\"Back\" action=\"bypass -h admin_show_characters 0\" width=40 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append("</tr></table><br>"); replyMSG.append("<table width=270>"); replyMSG.append("<tr><td width=100>Account/IP:</td><td>" + player.getAccountName() + "/" + player.getIP() + "</td></tr>"); replyMSG.append("<tr><td width=100>Name/Level:</td><td>" + player.getName() + "/" + player.getLevel() + "</td></tr>"); replyMSG.append( "<tr><td width=100>Class/Id:</td><td>" + HtmlUtils.htmlClassName(player.getClassId().getId()) + "/" + player.getClassId().getId() + "</td></tr>"); replyMSG.append("<tr><td width=100>Clan/Level:</td><td>" + clanName + "</td></tr>"); replyMSG.append( "<tr><td width=100>Exp/Sp:</td><td>" + player.getExp() + "/" + player.getSp() + "</td></tr>"); replyMSG.append("<tr><td width=100>Cur/Max Hp:</td><td>" + (int) player.getCurrentHp() + "/" + player.getMaxHp() + "</td></tr>"); replyMSG.append("<tr><td width=100>Cur/Max Mp:</td><td>" + (int) player.getCurrentMp() + "/" + player.getMaxMp() + "</td></tr>"); replyMSG.append("<tr><td width=100>Cur/Max Load:</td><td>" + player.getCurrentLoad() + "/" + player.getMaxLoad() + "</td></tr>"); replyMSG.append("<tr><td width=100>Patk/Matk:</td><td>" + player.getPAtk(null) + "/" + player.getMAtk(null, null) + "</td></tr>"); replyMSG.append("<tr><td width=100>Pdef/Mdef:</td><td>" + player.getPDef(null) + "/" + player.getMDef(null, null) + "</td></tr>"); replyMSG.append("<tr><td width=100>PAtkSpd/MAtkSpd:</td><td>" + player.getPAtkSpd() + "/" + player.getMAtkSpd() + "</td></tr>"); replyMSG.append("<tr><td width=100>Acc/Evas:</td><td>" + player.getAccuracy() + "/" + player.getEvasionRate(null) + "</td></tr>"); replyMSG.append("<tr><td width=100>Crit/MCrit:</td><td>" + player.getCriticalHit(null, null) + "/" + df.format(player.getMagicCriticalRate(null, null)) + "%</td></tr>"); replyMSG.append("<tr><td width=100>CritDmg/MCritDmg:</td><td>" + player.getCriticalDmg(null, null) + "/" + player.getMagicCriticalDmg(null, null) + "</td></tr>"); replyMSG.append("<tr><td width=100>Walk/Run:</td><td>" + player.getWalkSpeed() + "/" + player.getRunSpeed() + "</td></tr>"); replyMSG.append("<tr><td width=100>Karma/Fame:</td><td>" + player.getKarma() + "/" + player.getFame() + "</td></tr>"); replyMSG.append("<tr><td width=100>PvP/PK:</td><td>" + player.getPvpKills() + "/" + player.getPkKills() + "</td></tr>"); replyMSG.append("<tr><td width=100>Coordinates:</td><td>" + player.getX() + "," + player.getY() + "," + player.getZ() + "</td></tr>"); replyMSG.append("<tr><td width=100>Direction:</td><td>" + PositionUtils.getDirectionTo(player, activeChar) + "</td></tr>"); replyMSG.append("</table><br>"); replyMSG.append("<table<tr>"); replyMSG.append( "<td><button value=\"Skills\" action=\"bypass -h admin_show_skills\" width=80 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append( "<td><button value=\"Effects\" action=\"bypass -h admin_show_effects\" width=80 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append( "<td><button value=\"Actions\" action=\"bypass -h admin_character_actions\" width=80 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append("</tr><tr>"); replyMSG.append( "<td><button value=\"Stats\" action=\"bypass -h admin_edit_character\" width=80 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append( "<td><button value=\"Exp & Sp\" action=\"bypass -h admin_add_exp_sp_to_character\" width=80 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); replyMSG.append("<td></td>"); replyMSG.append("</tr></table></body></html>"); adminReply.setHtml(replyMSG.toString()); activeChar.sendPacket(adminReply); }
From source file:com.salesmanager.core.module.impl.application.currencies.USDCurrencyModule.java
public String getFormatedAmount(BigDecimal amount) throws Exception { NumberFormat nf = null; nf = NumberFormat.getInstance(Locale.US); nf.setMaximumFractionDigits(2);// www . j av a2 s. c om nf.setMinimumFractionDigits(2); return nf.format(amount); }
From source file:com.salesmanager.core.module.impl.application.currencies.USDCurrencyModule.java
public String getMeasure(BigDecimal measure, String currencycode) throws Exception { NumberFormat nf = null; nf = NumberFormat.getInstance(Locale.US); nf.setMaximumFractionDigits(1);// ww w .j a v a2s. c o m nf.setMinimumFractionDigits(1); measure.setScale(1, BigDecimal.ROUND_HALF_UP); return nf.format(measure); }
From source file:com.attribyte.essem.model.index.IndexStats.java
private String asCount(final long val) { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0);/*from www . j a v a 2s .c o m*/ nf.setMinimumIntegerDigits(1); return nf.format(val); }
From source file:com.attribyte.essem.model.index.IndexStats.java
private String asPercent(final double val) { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2);/* w ww . j a v a 2s .c o m*/ nf.setMinimumIntegerDigits(1); return nf.format(val * 100.0); }
From source file:com.attribyte.essem.model.index.IndexStats.java
/** * Gets a value as KB.//from w w w. j a v a 2s .c o m * @param val The value. * @return The value as KB. */ private String asKB(final long val) { double valBytes = (double) val; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0); nf.setMinimumIntegerDigits(1); return nf.format(valBytes / 1024.0); }
From source file:com.attribyte.essem.model.index.IndexStats.java
/** * Gets a value as MB.// w w w. j a v a2s . c om * @param val The value. * @return The value as MB. */ private String asMB(final long val) { double valBytes = (double) val; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0); nf.setMinimumIntegerDigits(1); return nf.format(valBytes / 1000 / 1000); }
From source file:com.salesmanager.core.module.impl.application.currencies.EURCurrencyModule.java
public String getFormatedAmount(BigDecimal amount) throws Exception { NumberFormat nf = null; nf = NumberFormat.getInstance(Locale.GERMAN); nf.setMaximumFractionDigits(2);//from w w w . j av a 2s . c om nf.setMinimumFractionDigits(2); return nf.format(amount); }
From source file:com.salesmanager.core.module.impl.application.currencies.EURCurrencyModule.java
public String getMeasure(BigDecimal measure, String currencycode) throws Exception { NumberFormat nf = null; nf = NumberFormat.getInstance(Locale.GERMAN); nf.setMaximumFractionDigits(1);// w ww . j a v a2s . c o m nf.setMinimumFractionDigits(1); measure.setScale(1, BigDecimal.ROUND_HALF_UP); return nf.format(measure); }
From source file:com.android.ddmuilib.HeapPanel.java
private static String fractionalPercent(long num, long denom) { double val = (double) num / (double) denom; val *= 100;//from w w w .j a v a 2 s. c o m NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); return nf.format(val) + "%"; }