IntegerPrinter.java 604B

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