+ 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?
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.
+ 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?
+ 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);
0
jh