String.getBytes() returns different values for multiple execution?

后端 未结 2 1549
public static void main(String[] args) {
    try {
        String name = \"i love my country\";
        byte[] sigToVerify = name.getBytes();
        System.out.println(         


        
2条回答
  •  清酒与你
    2021-01-22 18:52

    try printing out the contents of the byte array instead of the toString() result of the variable

    for(byte b : sigToVerify)
        System.out.print(b +"\t");
    

    if the bytes getting printed are the same, then you're good to go.

提交回复
热议问题