Labs
- Create a program with a method that takes an
intparameter. The method should loop from 1 to that number, printing each number in hexadecimal, decimal, and octal. Call this method frommain.
(Solution: PrintNumbers.java)
- Modify your program to include the binary number in the output. Test by printing the numbers up to 66,000.
(Solution: PrintNumbers2.java)
- Modify your program to print the numbers in fixed-width columns. Hexadecimal numbers should be padded with leading zeros and be prefixed
0x. Binary numbers should be prefixed with0b. Octal numbers should be prefixed with a single0.
(Solution: PrintNumbers3.java)