Created
November 4, 2015 03:59
-
-
Save mattmccarthy11/1ac0db84f0e5f6f4a751 to your computer and use it in GitHub Desktop.
Sort Arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String[] mystr = {"Jack","Fortran","Amon","Cpp","Phaser"}; | |
| for(int i=0;i<mystr.length-1;i++){ | |
| for(int j=i+1 ;j<mystr.length;j++){ | |
| if( mystr[i].compareTo(mystr[j]) > 0 ){ | |
| String tmp = mystr[i]; | |
| mystr[i]= mystr[j]; | |
| mystr[j]=tmp; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment