IntegerPrinter.java 565B

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