Seems to work

This commit is contained in:
Arti Zirk 2016-08-29 11:16:29 +03:00
parent 9b58a62f9e
commit b30be927ba

View File

@ -1,14 +1,31 @@
public class Balls { public class Balls {
enum Color {green, red}; enum Color {green, red};
public static void main (String[] param) {
// for debugging
}
public static void main (String[] param) { public static void reorder (Color[] balls) {
// for debugging int redBallCount = 0;
}
for (int i = 0; i < balls.length; i++) {
public static void reorder (Color[] balls) { if (balls[i] == Color.red) {
// TODO!!! Your program here redBallCount++;
} }
}
if (redBallCount == balls.length) {
return;
}
for (int i = 0; i < redBallCount; i++) {
balls[i] = Color.red;
}
for (int i = redBallCount; i < balls.length; i++) {
balls[i] = Color.green;
}
}
} }