private static String getDigitPattern(int numberOfDigits, boolean zeroes, boolean grouping) {
		if (numberOfDigits < 0) {
			throw new NumberUtilError("Number of digits has to be >= 0");
		}

		StringBuilder sb = new StringBuilder(numberOfDigits);

		if (digitPattern.containsKey(numberOfDigits)) {
			sb.append(digitPattern.get(numberOfDigits)[zeroes ? 1 : 0]);
		} else {

			sb.append(digitPattern.get(MAX_DIGIT_PATTERN)[zeroes ? 1 : 0]);

			if (zeroes) {
				for (int i = MAX_DIGIT_PATTERN; i < numberOfDigits; i++) {
					sb.append("0");
				}
			} else {
				for (int i = MAX_DIGIT_PATTERN; i < numberOfDigits; i++) {
					sb.append("#");
				}
			}

		}

		if (grouping && sb.length() > 3) {
			//Add the grouping separator if requested
			sb.insert(sb.length() - 3, ',');
		}

		return sb.toString();
	}