private char[] convertToCharArray(CharSequence charSequence){
  if (charSequence == null) {
    return null;
  }
  char[] charArray=new char[charSequence.length()];
  for (int i=0; i < charSequence.length(); i++) {
    charArray[i]=charSequence.charAt(i);
  }
  return charArray;
}

private char [ ] convertToCharArray ( CharSequence charSequence ) { if ( charSequence == null ) { return null ; } char [ ] charArray = new char [ charSequence . length ( ) ] ; for ( int i = 0 ; i < charSequence . length ( ) ; i ++ ) { charArray [ i ] = charSequence . charAt ( i ) ; } return charArray ; }
convert a charsequence ( which are utf16 ) into a char array . note : a string . getbytes ( ) is not used to avoid creating a string of the password in the jvm .
