Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public static void main(String[] args) {
  2. int [] loc = {25, 11, 250,5, 45,8,10,45,31,123,489};
  3. for(int i = 0; i < loc.length; i ++) {
  4. for (int j = loc.length-1; j >i ; j--) {
  5. if (loc[j] < loc[j - 1]) {
  6. int temp = loc[j];
  7. loc[j] = loc[j - 1];
  8. loc[j - 1] = temp;
  9. }
  10. }
  11. }
  12.  
  13. for(int i = 0; i < 3; i ++) {
  14. System.out.println(loc[i]);
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement