package cat; public class kata{ public static int doubleValue(int x) { return (int) doubleButWorse(x); } private static float doubleButWorse(float x){ float half = x / 2f; if (x == half){ return x; } return x + doubleButWorse(half); } }
- package cat;
- public class kata{
- public static int doubleValue(int x) {
return x * 2;- return (int) doubleButWorse(x);
- }
- private static float doubleButWorse(float x){
- float half = x / 2f;
- if (x == half){
- return x;
- }
- return x + doubleButWorse(half);
- }
- }