I am working on an accounting system that calls for rows to be deleted out of arrays.

Say for instance that I know the indices of the row I wish to delete. How would I go about writing code to do this? I am trying to delete rows out of a 2D array.

Here's how I'm trying to go about this:
- create a copy of the 2D array
- copy the 2D array back into the original array, skipping the row that I don't want copied back (i.e. deleting the row)

The code below just makes the values in the cells to be deleted (the cells in the row to be deleted) all zeroes (the default values for the primitive type double), instead of actually getting rid of the row.

Look at the code below for what I'm talking about:

The code in the if block finds the row that I want to delete. I would use an easier method to do this, but my teacher wants it done this way.

LRRMasterArray = new double[LRRNumberofRows][]; // this needs to be LRRMasterArray = new double[LRRNumberofRows - 1][], but that doesn't compile for some reason

for (int row = 0; row < LRRdblTempArray.length; row++)
{
if (LRRdblTempArray[row][0] == LRRgetCustomerID())
{
LRRMasterArray[row] = new double[LRRdblTempArray[row].length];
} // end if
else
{
LRRMasterArray[row] = new double[LRRdblTempArray[row].length];
for (int col = 0; col < LRRMasterArray[row].length; col++)
{
LRRMasterArray[row][col] = LRRdblTempArray[row][col];
}
}

Thank you for reading this and any help from anyone would be greatly appreciated.