Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to judge whether it is an integer constant in octal and hexadecimal?
How to judge whether it is an integer constant in octal and hexadecimal?
Inside the computer, the numbers themselves are indistinguishable. Because the definition of numbers is int (including Integer, long, etc. ) are all stored in binary, so it is impossible to know whether you want to use octal or 16.

Only human intervention, you want to use the X system to represent a number.

Unless you store integers in the form of strings, even then, you can't tell whether the data like "12345" is octal, or 16, or even 10 or 9.

Only numbers like "1234ABC" can know that this is definitely not octal.

If you must implement octal or n-ary, you can only implement the class of n-ary by yourself, and use this class to define integers, so that you can judge whether it is n-ary.