标签:color argument bsp system illegal public int for nbsp
public static void main(String[] args) { int[] intArr = {1, 3, 5, 8, 9, 12}; int sum = 10; int right = intArr.length - 1; for (int i=0; i < intArr.length; ) { if (right == i) { throw new IllegalArgumentException("未获取到有效取和值"); } if (sum == intArr[right] + intArr[i]) { System.out.println("left index:" + i + ",left num:" + intArr[i] + "; right index:" + right + ",right num:" + intArr[right]); break; } else if (sum < intArr[right] + intArr[i]) { right--; } else { i++; continue; } } }
标签:color argument bsp system illegal public int for nbsp
原文地址:https://www.cnblogs.com/wangzxblog/p/11082683.html