Sorting arrays.
>> Monday, May 23, 2011
For Sorting arrays we use Arrays,sort(array) method.
Example:
Example:
import java.util.Arrays;
public class MainClass {
public static void main(String[] a) {
int array[] = { 2, 5, -2, 6, -3 };
Arrays.sort(array);
for (int i : array) {
System.out.println(i);
}
}
}
0 comments:
Post a Comment