Published by Zaheer
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 [...]
. Apr 13, 2008
Filed under: Java
Tags: Array, Java, maximum, minimum
Published by Zaheer
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 [...]
. Dec 05, 2007
Filed under: Javascript
Tags: Array, Javascript, numeric array, Sort, Sort numbers, sort numeric arrays