diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java index 3b14806aab..90934ed4a4 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java @@ -1206,7 +1206,7 @@ public class DecimalFormat extends NumberFormat { // } int i; - char [] digits = symbols.getDigits(); + char [] digits = symbols.getDigitsLocal(); char grouping = currencySignCount > 0 ? symbols.getMonetaryGroupingSeparator() : symbols.getGroupingSeparator(); @@ -2118,7 +2118,7 @@ public class DecimalFormat extends NumberFormat { // DigitList, and adjust the exponent as needed. digits.decimalAt = digits.count = 0; - char [] digitSymbols = symbols.getDigits(); + char [] digitSymbols = symbols.getDigitsLocal(); char decimal = currencySignCount > 0 ? symbols.getMonetaryDecimalSeparator() : symbols .getDecimalSeparator(); char grouping = symbols.getGroupingSeparator(); diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormatSymbols.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormatSymbols.java index 0d87e9d485..2d378dac62 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormatSymbols.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormatSymbols.java @@ -184,6 +184,23 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { return digitArray; } } + + /** + * Returns the array of characters used as digits, in order from 0 through 9 + * Package private method - don't need to defensively copy. + * @return The array + */ + char[] getDigitsLocal() { + if ( digits != null ) { + return digits; + } else { + char [] digitArray = new char[10]; + for ( int i = 0 ; i < 10 ; i++ ) { + digitArray[i] = (char) (zeroDigit + i); + } + return digitArray; + } + } /** * Sets the character used for zero.