View Single Post
Join Date: Dec 2004
Posts: 4,126
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 472
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Ordering an array

 
0
  #2
Oct 25th, 2007
Use class Arrays. This class contains various methods for manipulating arrays.

Info from API on sort(int[] a)

Here is a nice refference to sorting

An here is just small quick example
  1. import java.util.*;
  2.  
  3. public class Sort {
  4. public static void main(String[] args) {
  5. int[] arr = new int[] {5, 3, 1, 6, 7};
  6. Arrays.sort(arr);
  7. for(int i =0; i< arr.length; i++)
  8. {
  9. System.out.print(arr[i] + " ");
  10. }
  11. System.out.println();
  12. }
  13. }
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote