class FSUtilities {

	public static String getExtension(String path, int extLevel) {

		Objects.requireNonNull(path);
		if (extLevel < 1) {
			throw new IllegalArgumentException("Bad extention level: " + extLevel);
		}

		for (int i = path.length() - 1; i >= 0; i--) {
			char c = path.charAt(i);
			if (SEPARATOR_CHARS.indexOf(c) != -1) { // moved past the filename				
				return null;
			}
			if (c == DOT) {
				if (--extLevel == 0) {
					return path.substring(i);
				}
			}
		}
		return null;
	}

}