Driver code
public static void main ( String [ ] args ) { char str [ ] = " g ▁ eeks ▁ for ▁ ge ▁ eeks ▁ " . toCharArray ( ) ; int i = removeSpaces ( str ) ; System . out . println ( String . valueOf ( str ) . subSequence ( 0 , i ) ) ; } }