question: public static String camelCaseToUnderlines ( String string ) { if ( string . isEmpty ( ) ) { return string ; } StringBuilder sb = new StringBuilder ( 2 * string . length ( ) ) ; int n = string . length ( ) ; boolean lastWasUpperCase = Character . isUpperCase ( string . charAt ( 0 ) ) ; for ( int i = 0 ; i < n ; i ++ ) { char c = string . charAt ( i ) ; boolean isUpperCase = Character . isUpperCase ( c ) ; if ( isUpperCase && ! lastWasUpperCase ) { sb . append ( '_' ) ; } lastWasUpperCase = isUpperCase ; c = Character . toLowerCase ( c ) ; sb . append ( c ) ; } return sb . toString ( ) ; }
target:  Converts a CamelCase word into an underlined_word