last_group = index; } else if (c >= zero && c <= zero + 9) {
last_group = index+1; } else if (c >= zero && c <= zero + 9) {
	public Number parse(String str, ParsePosition pos) {		// Our strategy is simple: copy the text into a buffer,		// translating or omitting locale-specific information.  Then		// let Double or Long convert the number for us.		boolean is_neg = false;		int index = pos.getIndex();		StringBuffer buf = new StringBuffer();		// We have to check both prefixes, because one might be empty.		// We want to pick the longest prefix that matches.		boolean got_pos = str.startsWith(positivePrefix, index);		String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign());		boolean got_neg = str.startsWith(np, index);		if (got_pos && got_neg) {			// By checking this way, we preserve ambiguity in the case			// where the negative format differs only in suffix.  We			// check this again later.			if (np.length() > positivePrefix.length()) {				is_neg = true;				index += np.length();			} else				index += positivePrefix.length();		} else if (got_neg) {			is_neg = true;			index += np.length();		} else if (got_pos)			index += positivePrefix.length();		else {			pos.setErrorIndex(index);			return null;		}		// FIXME: handle Inf and NaN.		// FIXME: do we have to respect minimum/maxmimum digit stuff?		// What about leading zeros?  What about multiplier?		int start_index = index;		int max = str.length();		char zero = symbols.getZeroDigit();		int last_group = -1;		boolean int_part = true;		boolean exp_part = false;		for (; index < max; ++index) {			char c = str.charAt(index);			// FIXME: what about grouping size?			if (groupingUsed && c == symbols.getGroupingSeparator()) {				if (last_group != -1 && (index - last_group) % groupingSize != 0) {					pos.setErrorIndex(index);					return null;				}				last_group = index;			} else if (c >= zero && c <= zero + 9) {				buf.append((char) (c - zero + '0'));				exp_part = false;			} else if (parseIntegerOnly)				break;			else if (c == symbols.getDecimalSeparator()) {				if (last_group != -1 && (index - last_group) % groupingSize != 0) {					pos.setErrorIndex(index);					return null;				}				buf.append('.');				int_part = false;			} else if (c == symbols.getExponential()) {				buf.append('E');				int_part = false;				exp_part = true;			} else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) {				// For exponential notation.				buf.append(c);			} else				break;		}		if (index == start_index) {			// Didn't see any digits.			pos.setErrorIndex(index);			return null;		}		// Check the suffix.  We must do this before converting the		// buffer to a number to handle the case of a number which is		// the most negative Long.		boolean got_pos_suf = str.startsWith(positiveSuffix, index);		String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix);		boolean got_neg_suf = str.startsWith(ns, index);		if (is_neg) {			if (!got_neg_suf) {				pos.setErrorIndex(index);				return null;			}		} else if (got_pos && got_neg && got_neg_suf) {			is_neg = true;		} else if (got_pos != got_pos_suf && got_neg != got_neg_suf) {			pos.setErrorIndex(index);			return null;		}		String suffix = is_neg ? ns : positiveSuffix;		if (is_neg)			buf.insert(0, '-');		String t = buf.toString();		Number result = null;		try {			result = new Long(t);		} catch (NumberFormatException x1) {			try {				result = new Double(t);			} catch (NumberFormatException x2) {			}		}		if (result == null) {			pos.setErrorIndex(index);			return null;		}		pos.setIndex(index + suffix.length());		return result;	}