12345678910111213141516171819202122232425262728293031323334 |
- import java.util.Scanner;
-
-
- public class IntegerPrinter {
-
- public static String printIntegerAsBinary(int value){
- String binary = Integer.toBinaryString(value);
- return binary;
- }
-
- public static String printIntegerAsOctal(int value){
- String octal = Integer.toOctalString(value);
- return octal;
- //return octal;
- }
-
- public static String printIntegerAsHexadecimal(int value){
- String Hexdecimal = Integer.toHexString(value);
- return Hexdecimal;
- }
-
- public static void main(String[] args){
- Scanner in = new Scanner(System.in);
- System.out.println("Please enter an interger");
- int i = in.nextInt();
-
- printIntegerAsBinary(i);
- printIntegerAsHexadecimal(i);
- printIntegerAsHexadecimal(i);
-
-
- }
- }
|