fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. byte[] bytes1 = new byte[]{-104, 73, 61, -15, -92, 109, 62, -99, 50, 82, 26, 87, 38, 110, -12, 49, -104, 73, 61, -15, -92, 109, 62, -99};
  14. byte[] bytes2 = new String(bytes1).getBytes();
  15. //for now bytes2 is equal to: {63, 73, 61, -15, -92, 109, 62, -99, 50, 82, 26, 87, 38, 110, -12, 49, 63, 73, 61, -15, -92, 109, 62, -99}
  16. System.out.println(Arrays.equals(bytes1, bytes2));//false
  17. for(int i = 0; i < bytes2.length; i++){
  18. if(bytes2[i] == 63) {
  19. bytes2[i] = -104;
  20. }
  21. }
  22. System.out.println(Arrays.equals(bytes1, bytes2));//true
  23. }
  24. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
false
false