Base-n series generator for a given number in Java,

I want to create a program to generate a given base-n series,

Is there any general mechanism to find these numbers so that I can program for base - N

Update: – after exercise, I face a problem

What if I want to deal with that integer? Someone commented that I should use the baseinteger class Please specify

Solution

You can use integer's toString (int i, int radius) method

For example:

Integer.toString(2,2) // number 2,base 2

Return string:

"10"

Note that the cardinality should be between 1 and 36

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>