IntegerPrinter.java 555B

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