Problem
This is a follow up to my previous question, Base-changing numbers in Java
I have followed @Pimgd’s advice in the answer to that question, and I’m posting the improved code for any further review.
Note:
I didn’t bother with whitespace in the test method, because I don’t use it anyway. It also isn’t up for review, it’s just there to help people to run the program quick and dirty.
Here’s the code:
/**
* Converts a number in digit representation from one base to another
* Not guaranteed to work with bases above 65,451 (more characters than which the lookup can use for substituting digits)
*
* @author Tamoghna Chowdhury
* @version 1.2
*/
public class BaseConverter {
protected static final String negativeBaseErrorMessage = "Negative or zero base values are illegal - supplied bases were %d & %d.",
invalidInputNumberErrorMessage = "The supplied number (%s) for base conversion is invalid.",
tooLargeBaseForLookupErrorMessage = "Not enough available characters for substitution. Number of available characters is %d , minimum required number is %d";
private static String lookup = "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstwxyz+/=,?!;:"'^`~|\@#$%&
Solution
*_<
>
(){}""