New To Java - Converting a BigInteger to a String of words using some rules

After decrypting something I have a huge BigInteger and now I want to convert it to letters with some rules like these : 01 : A; 02 : B; 03 : C;...;27 : [space];28 : [.];31 : [']How would you do that?
[222 byte] By [Hydexa] at [2007-11-26 23:31:24]
# 1
Use an array to capture that.
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 2
Hum, an array? You mean I put all my rules in an array ? But how do I "scan" my BigInteger for comparisons?
Hydexa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 3
How big is the array?
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 4
But how do I "scan" my BigInteger for comparisons?Turn it into a string first?
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 5
Hmmmmm I'm not very familiar with Strings, I'll have to study it a bit betterThe BigInteger 100 digits approximatelyThe array of rules would be 31 (I have 31 different cases)
Hydexa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 6
Are you mapping pairs of digits in the number to a character, or are you trying to represent the number in base 32, with your own "digit set"?
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 7
mapping pairs of digits in the number to a character > Yes, directly.
Hydexa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 8

I don't see any methods that let you directly access the decimal digits of a BigInteger,

but you can always turn it into a decimal string and anaylse the string. Why are you doing this?

I ask, because if the character choices in your

map are flexible, you can use the toString method that takes a radix:

import java.math.BigInteger;

public class BigIntegerExample {

public static void main(String[] args) {

BigInteger x = new BigInteger("123456789012345678901234567890");

String s = x.toString(36); //base 36

System.out.println(s);

}

}

DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 9
It's a cryptanalysis exercise, I did decrypt something into decimal digits, now I have to turn it to letters : )So I have no choice about the rules...
Hydexa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 10
Okay, but why ever turn it into a BigInteger? I see your process like this:"Original message string " -> "...encrypted string...:" -> back to "original message string"Why do you gain by having a BigInteger?
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 11
Well, I don't have the original string, I have to compute with some numbers (namely, I decrypt an RSA code to prove it is insecure with low public exponent), so I have to do quite a number of calculations and BigInteger is mandatory for that...
Hydexa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...
# 12
Okay.
DrLaszloJamfa at 2007-7-10 14:43:10 > top of Java-index,Java Essentials,New To Java...