public static List<Integer> computeJavaIdentifierCorrections(String s)
	{
		List<Integer> correctionIndices = new LinkedList<Integer>();

		if (s == null || s.length() == 0)
		{
			return correctionIndices;
		}

		char[] c = s.toCharArray();

		if (!Character.isJavaIdentifierStart(c[0]))
		{
			correctionIndices.add(0);
		}

		for (int i = 1; i < c.length; i++)
		{
			if (!Character.isJavaIdentifierPart(c[i]))
			{
				correctionIndices.add(i);
			}
		}

		return correctionIndices;
	}
public static List < Integer > computeJavaIdentifierCorrections ( String s ) { List < Integer > correctionIndices = new LinkedList < Integer > ( ) ; if ( s == null || s . length ( ) == 0 ) { return correctionIndices ; } char [ ] c = s . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( c [ 0 ] ) ) { correctionIndices . add ( 0 ) ; } for ( int i = 1 ; i < c . length ; i ++ ) { if ( ! Character . isJavaIdentifierPart ( c [ i ] ) ) { correctionIndices . add ( i ) ; } } return correctionIndices ; }
Computes the indices of characters that need to be replaced with valid characters in order to make 's' a valid
Java identifier. Please note that this method assumes that 's' is NOT a keyword.

@param s
the identifier to compute correction indices for.
@return the indices of the characters that need to be corrected in order to make the identifier a valid Java
identifier