public static ArrayList<Pair> findPairBySum(int[] arr,int sum){
		int[] tmp = arr.clone();
		Arrays.sort(tmp);
		
		ArrayList<Pair> list = new ArrayList<Pair>();
		
		for(int i=0;i<tmp.length-1;i++){
			int j = tmp.length-1;
			while(j>=0&&tmp[j]+tmp[i]>=sum){
				if(tmp[j]+tmp[i]==sum){
					list.add(new Pair(tmp[i],tmp[j]));
				}
				j--;
			}
		}
		
		return list;
	}