Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1.     public static String combine(String h1,String h2) {
  2.         int length = (h1.length() > h2.length()) ? h2.length() : h1.length();
  3.         StringBuilder builder = new StringBuilder();
  4.  
  5.         for (int i =0 ; i<length; i+=2) {
  6.             String output = h1.substring(i, (i + 2));
  7.             String output2 = h2.substring(i, (i + 2));
  8.  
  9.  
  10.             int decimal = Integer.parseInt(output, 16);
  11.             int decimal2 = Integer.parseInt(output2, 16);
  12.  
  13.  
  14.             int result = decimal ^ decimal2;
  15.             builder.append(result + " ");
  16.         }
  17.  
  18.         return builder.toString();
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement