CodeGym /Courses /Java Multithreading /Practice with numbering systems

Practice with numbering systems

Java Multithreading
Level 10 , Lesson 2
Available

"Hi, Amigo!"

18
Task
Java Multithreading, level 10, lesson 2
Locked
Numeral system converter
Implement the convertNumberToOtherNumberSystem method, which should convert number.getDigit() from one number system (numberSystem) to another (expectedNumberSystem). Throw a NumberFormatException if the passed number is invalid, e.g. the number "120" passed with the binary number system.
18
Task
Java Multithreading, level 10, lesson 2
Locked
Mastering the methods of the Integer class
Use the Integer.parseInt(String, int) method to implement the convertToDecimalSystem method, which should convert the passed string into a decimal number and return it as a string.
18
Task
Java Multithreading, level 10, lesson 2
Locked
Palindrome?
Declare and implement the private static Set<Integer> getRadix(String number), getRadix(String number) method, which needs to determine the number systems (from 2 to 36 inclusive) in which the representation of number (passed in the decimal representation) is a palindrome.
18
Task
Java Multithreading, level 10, lesson 2
Locked
Smallest possible radix
The main method's first argument is a string that contains a sequence of characters (All characters in the string have ASCII codes (32 to 127 inclusive). The string length does not exceed 255 characters.
Comments (4)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Senned Level 41, Azov, Russia
26 November 2019
Use only BigInteger(String val, int radix) for Numeral System Converter, there is not in conditions.
Seb Level 41, Crefeld, Germany
11 February 2020
Thanks for the hint.
BlueJavaBanana Level 37
28 November 2020
Also you don't need to check for a negative number - mine was failing erification until I took that out!
Justin Smith Level 41, Greenfield, USA, United States
17 July 2022
I can't believe how short the answer is (ignore CodeGym's "official" solution). Moral of this story: Any time you need to convert a whole number from one numeral system to another, send it through BigInteger!