byte[]配列をstringに変換しています。次に、文字列をbyte[]配列に変換し直します。次に、両方の配列が等しいかどうかを確認すると、それらが等しくないことがわかります。
byte[] ciphertext2=c.doFinal(username.getBytes("utf-8"));
//JUST CHECKING IGNORE
String qaz=new String(ciphertext2,"utf-8");
//qaz=qaz+"1";
System.out.println("just chekcing------------------------"+qaz);
byte[] ciphertext3=qaz.getBytes("utf-8");
if(Arrays.equals(ciphertext2,ciphertext3))
{
System.out.println("just chekcing they are equal------------------------");
}
else
System.out.println("just chekcing they are not equal------------------------");<br>
出力:
just chekcing they are not equal--------------------
なぜそれが機能しないのですか?
編集
JavaのBase64を使用する場合は完全に正常に機能します。しかし、バイトを文字列に、またはその逆に直接変換するときに、なぜそれが機能しないのですか?文字列をバイト配列に変換したり、その逆を行ったりすると、実際にはどうなりますか?