IntegerPrinter.java 475B

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