역순 정렬 사용 연습 1, 2, 3, 4, 5, 6 역순 6, 5, 4, 3, 2, 1.

//         
public class NiSuPaiLie {
	public static void main(String[] args) {
		//           long        
		long a1 = System.currentTimeMillis();

		int[] array = { 88, 4, 6, 7, 8, 9 };
		// Arrays.sort(array);

		for (int temp : array)
			System.out.print(temp + "  ");
		System.out.println();
		fun(array);
		for (int temp : array)
			System.out.print(temp + "  ");

		System.out.println();//   
		
		//              ,      ;
		//               ,      ;
		int a = 20;
		fun1(a);
		System.out.println(a);

		//            
		long a2 = System.currentTimeMillis();
		System.out.println("***********");
		System.out.println((a2 - a1) + "  ");//               0
	}

	/**
	 *              ,      
	 * 
	 * @param a
	 */
	public static void fun1(int a) {
		a = a + 10;
	}

	/**
	 *                      (  )
	 * 
	 * @param array
	 */
	public static void fun(int[] array) {
		int temp;
		for (int i = 0; i < array.length / 2; i++) {
			temp = array[array.length - 1 - i];
			array[array.length - 1 - i] = array[i];
			array[i] = temp;
		}

	}

}

좋은 웹페이지 즐겨찾기