/** * Sets the {@code RoundingMode} used by this {@code NumberFormat}. * @since 1.6 */ public void setRoundingMode(RoundingMode roundingMode) { if (roundingMode == null) { throw new NullPointerException("roundingMode == null"); } this.roundingMode = roundingMode; if (roundingMode != RoundingMode.UNNECESSARY) { // ICU4C doesn't support UNNECESSARY. double roundingIncrement = 1.0 / Math.pow(10, Math.max(0, getMaximumFractionDigits())); ndf.setRoundingMode(roundingMode, roundingIncrement); } } }
/** * Sets the maximum number of digits after the decimal point. * If the value passed is negative then it is replaced by 0. * Regardless of this setting, no more than 340 digits will be used. * * @param value the maximum number of fraction digits. */ @Override public void setMaximumFractionDigits(int value) { super.setMaximumFractionDigits(value); ndf.setMaximumFractionDigits(getMaximumFractionDigits()); // Changing the maximum fraction digits needs to update ICU4C's rounding configuration. setRoundingMode(roundingMode); }
/** * DOCUMENT ME! * * @return DOCUMENT ME! */ public int getMaximunFractionDigits() { return formatter.getMaximumFractionDigits(); }
/** * Gets the maximum number of digits allowed in the fraction portion of a number. */ public int getMaximumFractionDigits(){ return format.getMaximumFractionDigits(); } /**
public int getMaximunFractionDigits() { return formatter.getMaximumFractionDigits(); }
public void setup() { byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); inputFormat = new DecimalFormat(new String(buf)); decimalDigits = inputFormat.getMaximumFractionDigits(); }
@Override public void setup() { byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); inputFormat = new DecimalFormat(new String(buf)); decimalDigits = inputFormat.getMaximumFractionDigits(); }
private DecimalBDFormat(DecimalFormat df) { super(df); int maxDecDigits = df.getMaximumFractionDigits(); int mult = df.getMultiplier(); while(mult > 1) { ++maxDecDigits; mult /= 10; } _maxDecDigits = maxDecDigits; }
@Override public void setup() { byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); inputFormat = new DecimalFormat(new String(buf)); decimalDigits = inputFormat.getMaximumFractionDigits(); }
@Override public void setup() { byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); inputFormat = new DecimalFormat(new String(buf)); decimalDigits = inputFormat.getMaximumFractionDigits(); }
/** Sets the number of fractional decimal places to be displayed on the given * NumberFormat object to the value of the given integer. * @return The minimum and maximum fractional places settings that the * formatter had before this change, as an ImmutableList. */ private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) { ImmutableList<Integer> ante = ImmutableList.of( formatter.getMinimumFractionDigits(), formatter.getMaximumFractionDigits() ); formatter.setMinimumFractionDigits(min); formatter.setMaximumFractionDigits(max); return ante; }
@Override public int getMaxFractionDigits() { return getFormatInternal().getMaximumFractionDigits(); }
@Override public int getMaxFractionDigits() { return getFormatInternal().getMaximumFractionDigits(); }
/** Sets the number of fractional decimal places to be displayed on the given * NumberFormat object to the value of the given integer. * @return The minimum and maximum fractional places settings that the * formatter had before this change, as an ImmutableList. */ private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) { ImmutableList<Integer> ante = ImmutableList.of( formatter.getMinimumFractionDigits(), formatter.getMaximumFractionDigits() ); formatter.setMinimumFractionDigits(min); formatter.setMaximumFractionDigits(max); return ante; }
/** Sets the number of fractional decimal places to be displayed on the given * NumberFormat object to the value of the given integer. * @return The minimum and maximum fractional places settings that the * formatter had before this change, as an ImmutableList. */ private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) { ImmutableList<Integer> ante = ImmutableList.of( formatter.getMinimumFractionDigits(), formatter.getMaximumFractionDigits() ); formatter.setMinimumFractionDigits(min); formatter.setMaximumFractionDigits(max); return ante; }
/** Sets the number of fractional decimal places to be displayed on the given * NumberFormat object to the value of the given integer. * @return The minimum and maximum fractional places settings that the * formatter had before this change, as an ImmutableList. */ private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) { ImmutableList<Integer> ante = ImmutableList.of( formatter.getMinimumFractionDigits(), formatter.getMaximumFractionDigits() ); formatter.setMinimumFractionDigits(min); formatter.setMaximumFractionDigits(max); return ante; }
String LocaleCountry = new Locale("en").getDefault().getCountry(); String LocaleLanguage = new Locale("en").getDefault().getLanguage(); String LocaleCurrency = new DecimalFormatSymbols().getCurrency().toString(); String LocaleShortDateTimePattern =new SimpleDateFormat().toPattern(); char LocaleDecimalSeparator = new DecimalFormatSymbols().getDecimalSeparator(); char LocaleThousandSeparator = new DecimalFormatSymbols().getGroupingSeparator(); String LocaleThousandGrouping = String.format("%d;0", new DecimalFormat().getMaximumFractionDigits()); String LocaleNegativePrefix = new DecimalFormat().getNegativePrefix(); String LocaleNegativeSuffix =new DecimalFormat().getNegativeSuffix(); String Operator = Utils.getQwnername(context);
/** * Sets the maximum number of digits after the decimal point. * If the value passed is negative then it is replaced by 0. * Regardless of this setting, no more than 340 digits will be used. * * @param value the maximum number of fraction digits. */ @Override public void setMaximumFractionDigits(int value) { super.setMaximumFractionDigits(value); ndf.setMaximumFractionDigits(getMaximumFractionDigits()); // Changing the maximum fraction digits needs to update ICU4C's rounding configuration. setRoundingMode(roundingMode); }
/** * Sets the maximum number of digits after the decimal point. * If the value passed is negative then it is replaced by 0. * Regardless of this setting, no more than 340 digits will be used. * * @param value the maximum number of fraction digits. */ @Override public void setMaximumFractionDigits(int value) { super.setMaximumFractionDigits(value); ndf.setMaximumFractionDigits(getMaximumFractionDigits()); // Changing the maximum fraction digits needs to update ICU4C's rounding configuration. setRoundingMode(roundingMode); }
/** * Sets the maximum number of digits after the decimal point. * If the value passed is negative then it is replaced by 0. * Regardless of this setting, no more than 340 digits will be used. * * @param value the maximum number of fraction digits. */ @Override public void setMaximumFractionDigits(int value) { super.setMaximumFractionDigits(value); ndf.setMaximumFractionDigits(getMaximumFractionDigits()); // Changing the maximum fraction digits needs to update ICU4C's rounding configuration. setRoundingMode(roundingMode); }