[Solved] How do I pass an object 2d array (x,y) position into an int


I think this will do it. Also, Object[][] isn’t right.

private String[][] singleplay = {{"#","Name","Score"},{"1","----------","10"},{"2","----------","20"}};

/**
 * Returns the score.
 *
 * @param id
 *        The index of the entry in the array table.
 *
 * @throws ArrayIndexOutOfBoundsException
 *         When the destination relative position is out of bounds.
 *
 * @return The score, 0 if it's not an integer.
 */
int getScore(int id) throws ArrayIndexOutOfBoundsException{
    // Our destination is the third element of the id th
    // first-dimensional array element:
    final String scoreRaw=singleplay[id][2];
    // Try to convert it to an actual score.
    return scoreRaw.matches("^-?\\d+") ? Integer.parseInt(scoreRaw) : 0;
}

solved How do I pass an object 2d array (x,y) position into an int