public static void main(String[] args) {
List list = Arrays.asList(1,2,3,7,5,6,4);
StringBuffer str = new StringBuffer();
for (int i=0;i<list.size();i++) {
for (int j=i+1;j<list.size()-i;j++){
if(Integer.valueOf((Integer) list.get(i))+Integer.valueOf((Integer) list.get(j))==7){
str.append("(" + list.get(i) + " " + list.get(j) + ")");
}
}
}
System.out.println("str value is :"+str);
}
还有其他方法待补充