public class IntegerPrinter { public String printIntegerAsBinary(int value){ StringBuilder binary = new StringBuilder(); while(value >= 1) { if (value / 2 >= 1) binary.append(value % 2); value /= 2; } return binary.append("1").reverse().toString(); } public String printIntegerAsOctal(int value){ StringBuilder baseEight = new StringBuilder(); while((value/8) >= 1){// baseEight.append(value % 8); value /= 8; } return baseEight.append(value).reverse().toString(); } public String printIntegerAsHexadecimal(int value){ StringBuilder baseSixteen = new StringBuilder(); while((value/16) != 0){ if ((value / 16) >= 1) { if((value%16) >= 10){ baseSixteen.append((char) (87+(value%16))); } else{ baseSixteen.append(value % 16); } value /= 16; } } value = value >= 10 ? (char) 87+(value%16) : value; return baseSixteen.append(value).reverse().toString(); } public static void main(String[] args){ } }