配列内の加算値がある数の2つの数を探します.


	public static void main(String[] args) throws IOException {
	    int[] a={4,5,3,2,7,9,1};
	    findSumNum(a,10);
	    //1,9
	    //3,7
	    //5,5
}
	//      ,    ,               ,        
	public static void findSumNum(int[] a,int sum){
		Arrays.sort(a);
		int i=0,j=a.length-1;

		while(i<=j){
			if(a[i]+a[j]<sum) i++;
			else if(a[i]+a[j]>sum) j--;
			else {
				System.out.println(a[i]+","+a[j]);
				i++;
			}
		}		
	}