123456789101112131415161718192021222324252627282930 |
-
-
-
- public class IntegerPrinter {
-
- public String printIntegerAsBinary(int value){
- String bin = Integer.toBinaryString(value);
- System.out.println(bin);
- return bin;
- }
-
- public String printIntegerAsOctal(int value){
- String octal = Integer.toOctalString(value);
- System.out.println(octal);
- return octal;
- }
-
- public String printIntegerAsHexadecimal(int value){
- String hex = Integer.toHexString(value);
- System.out.println(hex);
- return hex;
- }
-
- // public static void main(String[] args){
- //I don't think it makes sense to have a main method here? Commented
- //out to be safe.
-
- // }
- }
|