Skip to content
Advertisement

Tag: multidimensional-array

Dividing a 1D array into a 2D array

So I have homework that asked me to: Write a method that takes two parameters: an array of integers and an integer that represents a number of elements. It should return a two-dimensional array that results from dividing the passed one-dimensional array into rows that contain the required number of elements. Note that the last row may have less number

Remove a specific row from a 2D Array

Given a 2D array and a string, how can I remove a row which does not contain a specific string? So far, I created a nested for loop which iterates through the array, adding all adjacent elements(except the string itself) to an ArrayList. However, I do not want to include elements from rows that exclude the specified string. If the

Advertisement