private DecimalFormat parse() throws ParseException { String stdPattern = fetchStandardPattern(); skipWS(); parseFormatStringExtension(); DecimalFormat decimalFormat; try { decimalFormat = new DecimalFormat(stdPattern, symbols); } catch (IllegalArgumentException e) { ParseException pe = new ParseException(e.getMessage(), 0); if (e.getCause() != null) { try { e.initCause(e.getCause()); } catch (Exception e2) { // Supress } } throw pe; } if (roundingMode != null) { if (_JavaVersions.JAVA_6 == null) { throw new ParseException("Setting rounding mode needs Java 6 or later", 0); } _JavaVersions.JAVA_6.setRoundingMode(decimalFormat, roundingMode); } if (multipier != null) { decimalFormat.setMultiplier(multipier.intValue()); } return decimalFormat; }
/** * Sets the multiplier for use in percent, per mille, and similar formats. */ public void setMultiplier(int multiplier){ format.setMultiplier(multiplier); } /**
/** * Sets the multiplier for use in percent, permill, etc. For a percentage, set the * suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent * symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be * 1000. * * <p>Examples: with 100, 1.23 -> "123", and "123" -> 1.23 * * @param newValue the multiplier * @stable ICU 2.0 */ public void setMultiplier(int newValue) { ((java.text.DecimalFormat)numberFormat).setMultiplier(newValue); }
/** * Sets the multiplier for use in percent, permill, etc. For a percentage, set the * suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent * symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be * 1000. * * <p>Examples: with 100, 1.23 -> "123", and "123" -> 1.23 * * @param newValue the multiplier * @stable ICU 2.0 */ public void setMultiplier(int newValue) { ((java.text.DecimalFormat)numberFormat).setMultiplier(newValue); }
/** * Returns a newly created DecimalFormat object * @param pattern the format pattern * @param multiplier the multiplier * @return the formatter */ private static DecimalFormat createDecimalFormat(String pattern, int multiplier) { final DecimalFormat decimalFormat = new DecimalFormat(pattern); decimalFormat.setMultiplier(multiplier); return decimalFormat; }
/** * Returns a newly created DecimalFormat object * @param pattern the format pattern * @param multiplier the multiplier * @return the formatter */ private static DecimalFormat createDecimalFormat(String pattern, int multiplier) { final DecimalFormat decimalFormat = new DecimalFormat(pattern); decimalFormat.setMultiplier(multiplier); return decimalFormat; }
DecimalFormat pctFormat = new DecimalFormat("##.0%"); pctFormat.setMultiplier(1); valueAxis.setNumberFormatOverride(pctFormat);
double d = 65.87; DecimalFormat df2 = new DecimalFormat(" #,##0.00 %"); df2.setMultiplier(1); System.out.println(df2.format(d));
DecimalFormat dOffset = new DecimalFormat(); DecimalFormat dFormat = new DecimalFormat("#,##0.00"); dOffset.setMultiplier(100);
@Override public void setMultiplier(int i) { DecimalFormat format = getFormat(); format.setMultiplier(i); setFormat(format); }
if (data.endsWith("%")) { df.setMultiplier(100); data = data.substring(0, data.length() - 1);
private DecimalFormat parse() throws ParseException { String stdPattern = fetchStandardPattern(); skipWS(); parseFormatStringExtension(); DecimalFormat decimalFormat; try { decimalFormat = new DecimalFormat(stdPattern, symbols); } catch (IllegalArgumentException e) { ParseException pe = new ParseException(e.getMessage(), 0); if (e.getCause() != null) { try { e.initCause(e.getCause()); } catch (Exception e2) { // Supress } } throw pe; } if (roundingMode != null) { if (_JavaVersions.JAVA_6 == null) { throw new ParseException("Setting rounding mode needs Java 6 or later", 0); } _JavaVersions.JAVA_6.setRoundingMode(decimalFormat, roundingMode); } if (multipier != null) { decimalFormat.setMultiplier(multipier.intValue()); } return decimalFormat; }
private DecimalFormat parse() throws ParseException { String stdPattern = fetchStandardPattern(); skipWS(); parseFormatStringExtension(); DecimalFormat decimalFormat; try { decimalFormat = new DecimalFormat(stdPattern, symbols); } catch (IllegalArgumentException e) { ParseException pe = new ParseException(e.getMessage(), 0); if (e.getCause() != null) { try { e.initCause(e.getCause()); } catch (Exception e2) { // Supress } } throw pe; } if (roundingMode != null) { if (_JavaVersions.JAVA_6 == null) { throw new ParseException("Setting rounding mode needs Java 6 or later", 0); } _JavaVersions.JAVA_6.setRoundingMode(decimalFormat, roundingMode); } if (multipier != null) { decimalFormat.setMultiplier(multipier.intValue()); } return decimalFormat; }
@Override public void setMultiplier(int i) { try { DecimalFormat format = getFormat(); format.setMultiplier(i); setFormat(format); if (isInitConfigDone()) { setValue(getValue()); } } finally { setFieldChanging(false); } }
private void printExtendOsInfo(CommandSender sender) { NativeManager nativeData = plugin.getNativeData(); //cpu double systemCpuLoad = nativeData.getCPULoad(); double processCpuLoad = nativeData.getProcessCPULoad(); //these numbers are in percent (0.01 -> 1%) //we want to to have four places in a human readable percent value to multiple it with 100 DecimalFormat decimalFormat = new DecimalFormat("###.#### %"); decimalFormat.setMultiplier(100); String systemLoadFormat = decimalFormat.format(systemCpuLoad); String processLoadFormat = decimalFormat.format(processCpuLoad); sendMessage(sender,"System Usage", systemLoadFormat); sendMessage(sender,"Process Usage", processLoadFormat); //swap long totalSwap = nativeData.getTotalSwap(); long freeSwap = nativeData.getFreeSwap(); sendMessage(sender, "Total Swap", readableBytes(totalSwap)); sendMessage(sender, "Free Swap", readableBytes(freeSwap)); //RAM long totalMemory = nativeData.getTotalMemory(); long freeMemory = nativeData.getFreeMemory(); sendMessage(sender, "Total OS RAM", readableBytes(totalMemory)); sendMessage(sender, "Free OS RAM", readableBytes(freeMemory)); }