Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA, please help with this method. /** * This method initializes the boolean mi

ID: 3604678 • Letter: J

Question

JAVA, please help with this method.

/**

   * This method initializes the boolean mines array passed in. A true value for

   * an element in the mines array means that location has a mine, false means

   * the location does not have a mine. The MINE_PROBABILITY is used to determine

   * whether a particular location has a mine. The randGen parameter contains the

   * reference to the instance of Random created in the main method.

   * Access the elements in the mines array with row then column (e.g., mines[row][col]).

   * Access the elements in the array solely using the actual size of the mines

   * array passed in, do not use constants.

   * A MINE_PROBABILITY of 0.3 indicates that a particular location has a

   * 30% chance of having a mine. For each location the result of

   * randGen.nextFloat() < Config.MINE_PROBABILITY

   * determines whether that location has a mine.

* This method does not print out anything.

   * @param mines The array of boolean that tracks the locations of the mines.

   * @param randGen The reference to the instance of the Random number generator

   * created in the main method.

   * @return The number of mines in the mines array.

   */

public static int placeMines(boolean[][] mines, Random randGen) {  

return -99;

}

Explanation / Answer

public static int placeMines(boolean[][] mines, Random randGen) { int len = mines.length; int innerlen = 0; if (len > 0) innerlen = mines[0].length; int count = 0; boolean temp = false; for(int i = 0;i