问题描述:比较两数组是否相等

Demo_1:

import java.util.Arrays;
public class TestArray {
	public static void main(String[] args){
		int[] a = {3,2,4,5,1,2,7,8,6,4,58,69,48,69};
		int[] b = {3,2,4,5,1,2,7,8,6,4,58,69,48,69};
		Arrays.sort(a);
		Arrays.sort(b);
		String s1 = Arrays.toString(a);
		String s2 = Arrays.toString(b);
		System.out.println(Arrays.equals(a,b)); //true
		System.out.println(s1.equals(s2)); //true		
	}
}

 

posted on 2017-10-02 15:16  牧羊人的世界  阅读(148)  评论(0编辑  收藏  举报