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.