public static int highestNumberPerimeter(int upperBound) {
        int perimeter = 1, a = 1, b = 1, c = 1, max = 0;
        int[] numberOfCombinations = new int[upperBound];
        // Initialize the array to all zeros
        for (int i = 0; i < upperBound; i++) {
            numberOfCombinations[i] = 0;
        }
        //Find all the right triangles to upperBound
        for (c = 1; c < upperBound / 2; c++) {
            for (b = 1; b < c; b++) {
                for (a = 1; a < b || a == b; a++) {
                    if (isRightTriangle(a, b, c) && (a + b + c) < upperBound) {
                        numberOfCombinations[a + b + c - 1] += 1;
                    }
                }
            }
        }
        for (int i = 0; i < numberOfCombinations.length; i++) {
            if (numberOfCombinations[i] > numberOfCombinations[max]) {
                max = i;
            }
        }
        return max + 1; // keep a return number for the IDE
    }