+ 1
Conversion of String(text) to BigInteger and reversal(i.e. getting back the text in order)
i am implementing the rsa algorithm, since we have to deal with very large nos, i am using bigInteger datatype. it works fine with numbers but now i will have to test it for strings, how will i cast string to bigInteger and then get back the string....
4 Respuestas
+ 1
BigInteger has a constructor that takes a String, and one that takes a String and radix (if you're using other than decimal numbers). It also has a toString() method that returns a decimal representation of the BigInteger.
https://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html
Hope this helps!
+ 1
Alternatively, you could use Character.isDigit () method on each character in the String to see it its a digit?
0
Thank You...It helps but when characters are there in string, it passes them as BigInteger which produces error. However i have now first converted string to byte array then to byte string and passed as you said...It works!