IntegerPrinter.java 563B

123456789101112131415161718192021222324
  1. public class IntegerPrinter {
  2. public String printIntegerAsBinary(int value){
  3. System.out.println(Integer.toString(value, 2));
  4. return Integer.toString(value, 2);
  5. }
  6. public String printIntegerAsOctal(int value){
  7. System.out.println(Integer.toString(value, 8));
  8. return Integer.toString(value, 8);
  9. }
  10. public String printIntegerAsHexadecimal(int value){
  11. System.out.println(Integer.toString(value, 16));
  12. return Integer.toString(value, 16);
  13. }
  14. public static void main(String[] args){
  15. }
  16. }