IntegerPrinter.java 670B

12345678910111213141516171819202122232425262728
  1. import java.util.*;
  2. public class IntegerPrinter {
  3. public String printIntegerAsBinary(int value){
  4. String binary = Integer.toBinaryString(value);
  5. //Integer i = new Integer(20);
  6. //String binary = Integer.toBinaryString(i);
  7. //System.out.println("Binary value: "+binary);
  8. return binary;
  9. }
  10. public String printIntegerAsOctal(int value){
  11. String binary = Integer.toOctalString(value);
  12. return binary;
  13. }
  14. public String printIntegerAsHexadecimal(int value){
  15. String binary = Integer.toHexString(value);
  16. return binary;
  17. }
  18. public static void main(String[] args){
  19. }
  20. }