Implementation of Multiparental Sorting Crossover
Parsing a line of space separated integers is repeated 4 times you can replace those with the method below:

private static int[] parseLineOfInts(String s) {
    String[] tokens = s.split(" ");
    int[] arr = new int[tokens.length];
    for (int j = 0; j &lt; tokens.length; j++)
       arr[j] = Integer.parseInt(tokens[j]);
    return arr;
}


You can use arrays of arrays to hold 2D data. Parsing the parents becomes as below:

int nParents = 3;
int[][] parents = new int[nParents][];
for (int i = 0; i &lt; nParents; i++) {
    parents[i] = parseLineOfInts(Input[i + 1]);
}


Note parent1 is now parent[0] and so on.

You can use parseLineOfInts method to calculate mask_elements as below:

int[] maskElements = parseLineOfInts(Input[0]);


parameters and local variables should be camelcase: first word starts with lowercase, subsequent words start with upper case:


Input should be input
parent_x should be parentX
parent_y should be parentY


Separate parsing and actual algorithm. Separation of concerns improves readability, testability, many other ...abilities. As a first step you can extract not string manipulation related code into a new function such that its signature becomes as below:

int[] solve(int[] mask, int[][] parents)