-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.java
56 lines (49 loc) · 1.47 KB
/
program.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
*
* @author AYANAVA SARKAR
*/
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.math.*;
public class lol {
public static void main (String[] args) throws java.lang.Exception
{
String h1 = "1c0111001f010100061a024b53535009181c";
BigInteger bi=new BigInteger(h1,16);
System.out.println(bi);
String binary1 = bi.toString(2);
String binary="000"+binary1;
System.out.println(binary);
String h2 = "686974207468652062756c6c277320657965";
BigInteger bi2=new BigInteger(h2,16);
String binary21 = bi2.toString(2);
String binary2="0"+binary21;
System.out.println(binary2);
int len1=binary.length();
int len2=binary2.length();
System.out.println(len1);
String res="";
if(len1>len2)
{
for(int i=0;i<len2;i++)
{
char c1=binary.charAt(i);
char c2=binary2.charAt(i);
res=res+(c1^c2);
}
}
else
{
for(int i=0;i<len1;i++)
{
char c1=binary.charAt(i);
char c2=binary2.charAt(i);
res=res+(c1^c2);
}
}
System.out.println(res);
System.out.println(new BigInteger(res, 2).toString(16));
//String bin = Long.toHexString(Long.parseLong(res,2));
//System.out.println(bin);
}
}