private void createAndConnectSegmentsToInputs() {
        upperArmSegment = null;

        if (shoulder != null && elbow != null) {
            List<Mass> upperArmInputs = getMassesBetweenYRange(shoulder.getY(), elbow.getY());

            if (upperArmInputs.size() == 2) {
                upperArmSegment = new Mass(shoulder.getX(), shoulder.getY(), ARM_SEGMENT);
                graph.addMasses(upperArmSegment);
                graph.addSpring(shoulder, upperArmSegment);
                graph.addSpring(elbow, upperArmSegment);
                graph.addSpring(upperArmInputs.get(0), upperArmSegment);
                graph.addSpring(upperArmInputs.get(1), upperArmSegment);
            }
        }

        lowerArmSegment = null;

        if (elbow != null && hand != null) {
            List<Mass> lowerArmInputs = getMassesBetweenYRange(elbow.getY(), hand.getY());

            if (lowerArmInputs.size() == 2) {
                lowerArmSegment = new Mass(elbow.getX(), elbow.getY(), ARM_SEGMENT);
                graph.addMasses(lowerArmSegment);
                graph.addSpring(elbow, lowerArmSegment);
                graph.addSpring(hand, lowerArmSegment);
                graph.addSpring(lowerArmInputs.get(0), lowerArmSegment);
                graph.addSpring(lowerArmInputs.get(1), lowerArmSegment);
            }
        }

        if (upperArmSegment != null && lowerArmSegment != null) {
            graph.addSpring(upperArmSegment, lowerArmSegment);
        }
    }