added comment for think method
parent
ae17a3013e
commit
58cac3d48a
|
@ -22,9 +22,16 @@ public class R2D2 extends StarWarsRobot {
|
|||
return 0 <= id && id <= 9999;
|
||||
}
|
||||
|
||||
/**
|
||||
* R2D2 think method sorts numbers with selection sort
|
||||
* @param numbers integer numbers for sorting
|
||||
* @return arrayToSort integer array with numbers sorted in ascending order
|
||||
* @throws RobotException
|
||||
* @throws RobotMagicValueException
|
||||
*/
|
||||
@Override
|
||||
public int[] think(int[] zahlen) throws RobotException, RobotMagicValueException {
|
||||
int[] arrayToSort = zahlen.clone();
|
||||
public int[] think(int[] numbers) throws RobotException, RobotMagicValueException {
|
||||
int[] arrayToSort = numbers.clone();
|
||||
for (int i = 0; i < arrayToSort.length; i++) {
|
||||
if (arrayToSort[i] == MAGIC_NUMBER) {
|
||||
throw new RobotMagicValueException(String.format("Appearance of Magic Number: %d", MAGIC_NUMBER), this);
|
||||
|
|
Loading…
Reference in New Issue