Advertisement
kuruku

SortArray

May 30th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3. import java.util.HashMap;
  4. import java.util.Scanner;
  5.  
  6. public class FiveSpecialLetters {
  7.  
  8.     public static void main(String[] args) {
  9.         int[] arrayInt = {8,6,4,1,3,6,13,10};
  10.         for (int i : arrayInt) {
  11.             System.out.print(i + " ");
  12.         }
  13.         System.out.println();
  14.         for (int i = 0; i < arrayInt.length; i++) {
  15.             for (int j = i+1; j < arrayInt.length - 1; j++) {
  16.                 if (arrayInt[i]>arrayInt[j]) {
  17.                     int temp = arrayInt[j];
  18.                     arrayInt[j] = arrayInt[i];
  19.                     arrayInt[i] = temp;
  20.                 }
  21.             }
  22.         }
  23.         for (int i : arrayInt) {
  24.             System.out.print(i + " ");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement