0

I assume aa568 uses a different base than 10.

What type of number is this most likely?

And how do you convert a decimal number into this base using Java?

5 Answers5

2

Assuming it is hexadecimal (0-9 + A-F instead of 0-9), you can convert it from hex to decimal as follows:

int i = Integer.parseInt(hexStr,16);

Where 16 is the base of the number system. Decimal is base 10, hexadecimal is base 16. And back from decimal to hexadecimal:

String hexStr = Integer.toHexString(i);

mrbellek
  • 2,300
  • 16
  • 20
2

Could it be hexadecimal? If it is then just precede that by 0x ie. 0xaa568.

evandrix
  • 6,041
  • 4
  • 27
  • 38
0

What kind of number may depend on the context, of none of the above fits, then it may be an integer sequence, I looked it up in the online encyclopedia of known integer sequences. Example a000045 is a Fibonacci sequence, (Formerly M0692 N0256), if it has to do with math it may also be a library reference to a paper written by AA. Only the Context can tell. Mathnet.ru had one reference "The behavior of the Lebesgue constants of two-dimensional Fourier sums over polygons" which fits the questioned number aa568.

0

Converting a number into a hexadecimal string can be done by the Integer.toHexString() method:

int number = 697704;

System.out.println(Integer.toHexString(number));

will print "aa568".

unwind
  • 391,730
  • 64
  • 469
  • 606
0

I'd assume that it's hexadecimal and more typically written 0xAA568 which is decimal 697704.

If you're asking how you would print a decimal number in a hexadecimal representation using Java ... see this stackoverflow article.

Community
  • 1
  • 1
jarmod
  • 71,565
  • 16
  • 115
  • 122