|
@@ -4,15 +4,19 @@
|
4
|
4
|
public class IntegerPrinter {
|
5
|
5
|
|
6
|
6
|
public String printIntegerAsBinary(int value){
|
7
|
|
- return null;
|
|
7
|
+ return printer(value, 2);
|
8
|
8
|
}
|
9
|
9
|
|
10
|
10
|
public String printIntegerAsOctal(int value){
|
11
|
|
- return null;
|
|
11
|
+ return printer(value, 8);
|
12
|
12
|
}
|
13
|
13
|
|
14
|
14
|
public String printIntegerAsHexadecimal(int value){
|
15
|
|
- return null;
|
|
15
|
+ return printer(value, 16);
|
|
16
|
+ }
|
|
17
|
+
|
|
18
|
+ public String printer(int value, int base) {
|
|
19
|
+ return Integer.toString(value, base);
|
16
|
20
|
}
|
17
|
21
|
|
18
|
22
|
public static void main(String[] args){
|