+ 3

How can I store a long binary code into a variable in a Java program?

I wan't to create a Java application that has user friendly interface and gets the encrypted product key from the user and decrypt it using the binary conversion method, I have the code to convert the text from binary but don't know how to store huge integers in a specific required variable. Please could someone help me?

29th Jan 2017, 3:37 PM
Azzaz Khan
Azzaz Khan - avatar
4 Réponses
+ 2
One (not necessarily best) possibility is to store binary digits as an ArrayList of ints, each with value 0 or 1.
29th Jan 2017, 11:10 PM
Igor B
Igor B - avatar
+ 2
I'm new and don't know much about Java but I think you're trying to explain like this, array(01010101, 0101010, 101010, 101001); is that what you're trying to explain?
30th Jan 2017, 5:31 PM
Azzaz Khan
Azzaz Khan - avatar
+ 2
I'm not sure if you want to store the value after convert it, but for big integers you can use the BigInteger class https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html You can use BigInteger bi = new BigInteger(value); if you want add a value bi = bi.add(new BigInteger(newValue);
12th Jul 2017, 1:24 AM
Eudy Veras
Eudy Veras - avatar
0
jh
10th Jul 2017, 8:38 PM
Toribio Nuñez
Toribio Nuñez - avatar