public static void main(String[] args) {
System.out.println(hasPairWithSum(new int[] { 12, 4, 3, 4, 1, 7 }, 9));
System.out.println(hasPairWithSum2(new int[] { 12, 4, 3, 4, 1, 7 }, 9));
System.out.println(hasPairWithSum3(new int[] { 12, 4, 3, 4, 1, 7 }, 9));
}
public static boolean hasPairWithSum(int[] intArray, int sum) {
int len = intArray.length;
for (int i = 0; i < len - 1; i++) {
for (int j = i + 1; j < len; j++) {
if (intArray[i] + intArray[j] …Run Code Online (Sandbox Code Playgroud)