question: public static String convertCodes ( String string ) { if ( string == null ) return string ; int current = 0 ; char [ ] cs = string . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( char c : cs ) { if ( current <= cs . length && c == '&' ) { char tc = Character . toLowerCase ( cs [ current + 1 ] ) ; if ( tc == '1' || tc == '2' || tc == '3' || tc == '4' || tc == '5' || tc == '6' || tc == '7' || tc == '8' || tc == '9' || tc == '0' || tc == 'a' || tc == 'b' || tc == 'c' || tc == 'd' || tc == 'e' || tc == 'f' || tc == 'k' || tc == 'l' || tc == 'm' || tc == 'n' || tc == 'o' ) { sb . append ( "§" ) ; } else { sb . append ( c ) ; } } else { sb . append ( c ) ; } current ++ ; } return sb . toString ( ) ; }
target:  Converts all color and format codes