Change newbie's code to set it to set highest value to the first index of the array. Then compare it like before. This way, it can handle negatives.
Type: Posts; User: javapenguin
Change newbie's code to set it to set highest value to the first index of the array. Then compare it like before. This way, it can handle negatives.
Kinda of.
int[] test = {1, 2, 3, 4};
int highestVal = 0;
int position = -1;
for (int i = 0; i < test.length; i++) {
if (test[i] > highestVal) {
...