I have an assigment in which i have implemented a BinaryNumber class that has a BitList that represented the binary number as lsb first.
I now want to implement a function that prints the decimal value of my binary number, even if its much much larger than int,long, or any one of those data types. for example:
BinaryNumber fib100 = new BinaryNumber("354224848179261915075")
//
100110011001111011011011
101101010011111000101100
101001011111111000011//
System.out.println(fib100.toIntString()); // prints 354224848179261915075
I have tried adding a field that stores the decimal value in which i initiated the BinaryNumber with, but unfortunately i am not allowed to do so.
Is there any algorithm which i couldnt find that helps me convert the binary number into a decimal string, without storing the values and needing a variable which isnt a string?