question: public static char [ ] toCharArray ( String s ) { if ( ! charArrayBugTested ) { charArrayBugTested = true ; if ( s . toCharArray ( ) == s . toCharArray ( ) ) { charArrayBug = true ; } } if ( charArrayBug ) { char [ ] c = new char [ s . length ( ) ] ; System . arraycopy ( s . toCharArray ( ) , 0 , c , 0 , c . length ) ; return c ; } return s . toCharArray ( ) ; }
target:  toCharArray should return a new array always, however some devices might suffer a bug that allows mutating a String (serious security hole in the JVM) hence this method simulates the proper behavior