Vector Math

So I finally figured out my ray casting problem, now the new problem I am facing is the math for line/plane intersection, I have learned a lot so far on the topic, just not enough. I have now figured out the whole Vector Math problem, here is my code:

Vector3f A = new Vector3f(0, 0, 0);
        Vector3f B = new Vector3f(1, 0, 0);
        Vector3f C = new Vector3f(1, 1, 0);
        float x = 0, x1 = A.x, x2 = B.x, x3 = C.x;
        float y = 0, y1 = A.y, y2 = B.y, y3 = C.y;
        float z = 0, z1 = A.z, z2 = B.z, z3 = C.z;
        float[] xC = new float[] {x - x1, x2 - x1, x3 - x1};
        float[] yC = new float[] {y - y1, y2 - y1, y3 - y1};
        float[] zC = new float[] {z - z1, z2 - z1, z3 - z1};
        float addI = (yC[1] * zC[2]) - (yC[2] * zC[1]);
        float addJ = -((xC[1] * zC[2]) - (xC[2] * zC[1]));
        float addK = (xC[1] * yC[2]) - (xC[2] * yC[1]);
        
        float numOfTs = (addI * (end.x - start.x)) + (addJ * (end.y - start.y)) + (addK * (end.z - start.z));
        float num = (addI * (x1)) + (addJ * (y1)) + (addK * (z1)) - (addI * start.x) - (addJ * start.y) - (addK * start.z);
        float t = num / numOfTs;
        x = start.x + ((end.x - start.x) * t);
        y = start.y + ((end.y - start.y) * t);
        z = start.z + ((end.z - start.z) * t);
        float vectX = (x + xC[0]);
        float vectY = (y + yC[0]);
        float vectZ = (z + zC[0]);
        Vector3f intersection = new Vector3f(vectX, vectY, vectZ);

On top of that, here is my Ray Casting bit if anyone needs it: (The compileBuffer methods just make Float and Int Buffers)

float[] matModelView = new float[16], matProjView = new float[16];
        int[] view = new int[16];
        float mouseX = width / 2;
        float mouseY = height / 2;
        Vector3f start = new Vector3f();
        Vector3f end = new Vector3f();

        FloatBuffer modelBuffer = compileBuffer(matModelView);
        FloatBuffer projBuffer = compileBuffer(matProjView);
        FloatBuffer startBuffer = compileBuffer(new float[]{start.x, start.y, start.z, 1});
        FloatBuffer endBuffer = compileBuffer(new float[]{end.x, end.y, end.z, 1});
        IntBuffer viewBuffer = compileBuffer(view);

        glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
        glGetFloat(GL_PROJECTION_MATRIX, projBuffer);
        glGetInteger(GL_VIEWPORT, viewBuffer);

        gluUnProject(mouseX, mouseY, 0.0f, modelBuffer, projBuffer, viewBuffer, startBuffer);
        gluUnProject(mouseX, mouseY, 1.0f, modelBuffer, projBuffer, viewBuffer, endBuffer);

        start = new Vector3f(startBuffer.get(0), startBuffer.get(1), startBuffer.get(2));
        end = new Vector3f(endBuffer.get(0), endBuffer.get(1), endBuffer.get(2));

The one problem I am facing when implementing my code into my game is finding the first plane that my line intersects, what it is doing now is going through the order that I test them in, and if the line happens to intersect that plane, that is the detected intersection, how can I make sure I am detecting the FIRST plane that my line intersects?