java简单数组反转

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class T1 {

    public static void main(String[] args) throws ParseException {
        
        //数组反转
        int[] a = {1,2,3,4,5,6};
        int min = 0;
        int max = a.length-1;
        int temp;
        
        while(min <= max){
            
            temp = a[min];
            a[min] = a[max];
            a[max] = temp;
            
            min++;
            max--;
            
        }
        
        for(int i = 0 ; i < a.length ; i++){
            System.out.println(a[i]);
        }
    }


版权声明:本文为weixin_37826998原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。