Three ways to find minimum and maximum values in a Java array.

In Java you can find maximum or minimum value in a numeric array by looping through the array. Here is the code to do that.

public static int getMaxValue(int[] numbers){
int maxValue = numbers[0];
for(int i=1;i < numbers.length;i++){
if(numbers[i] > maxValue){
maxValue = numbers[i];
}
}
return maxValue;
}

public static [...]

Sort numbers in Javascript array

Sorting an array in Javascript is a snap.

You create an array and then call sort() method on that array. The Javascript sort() method sorts an array in lexicographical order. This method is very useful in sorting alphanumeric values of an array. However, sort() will not work if the array consists of numeric values. Because [...]