I am slightly confused and hoping someone could shed some light on the matter. I created a function that removes horizontal lines from an image array and returns the image array without any horizontal lines. But when I call this function with my image array it also directly modifies the image array that I passed it. Why does this happen?
Example
int[][] imageArray = ImageToArray();
int[][] _NoLines = RemovedLines(imageArray);
imageArray should still have its lines right?
This is the actual function if anyone is curious:
public int[][] RemovedLines(int[][] _baseImage)
{
    int width = _baseImage[0].length, height = _baseImage.length;   
    
    int white = 0;
    int black = 0;
    
    for (int y = 0; y < height; y++) {
        white = 0;
        black = 0;
        for (int x = 0; x < width; x++) {
            if(_baseImage[y][x] == 0xFFFFFFFF){
                white++;
            }else{
                black++;
            }
        }
        if(black  > white)
        {
            // line detected fist time
            // now get height of line
            int _starts = y;
            _starts++;
            int _end = 0;
            
            for(; _starts < height; _starts++){
                white = 0;
                black = 0;
                for(int _x = 0; _x < width; _x++){
                    
                    if(_baseImage[_starts][_x] == 0xFFFFFFFF){
                        white++;
                    }else{
                        black++;
                    }
                }
                if(white > black){
                    // end of line height
                    _end = _starts;
                    _starts = y;
                    
                    break;
                }
            }
            white = 0;
            black = 0;
            for(;_starts < _end; _starts++){
                for(int line = 0; line < width; line++){
                    if(_baseImage[_starts-1][line] != 0xFF000000 
                        && _baseImage[_starts-2][line] != 0xFF000000
                        || _baseImage[_starts+1][line] != 0xFF000000 
                        && _baseImage[_starts+2][line] != 0xFF000000){
                        _baseImage[_starts][line] =0xFFFFFFFF;
                    }
                    
                }
            }
            y = _end;
        
        }
    }
    return _baseImage;
}
 
     
     
    