private int[] checkBoundaries(int[] minMax, int[] dim) {
        if (minMax[0] < 0) {
            minMax[0] = 0;
        }
        if (minMax[1] > dim[0]) {
            minMax[1] = dim[0];
        }
        if (minMax[2] < 0) {
            minMax[2] = 0;
        }
        if (minMax[3] > dim[1]) {
            minMax[3] = dim[1];
        }
        if (minMax[4] < 0) {
            minMax[4] = 0;
        }
        if (minMax[5] > dim[2]) {
            minMax[5] = dim[2];
        }
        return minMax;
    }
private int [ ] checkBoundaries ( int [ ] minMax , int [ ] dim ) { if ( minMax [ 0 ] < 0 ) { minMax [ 0 ] = 0 ; } if ( minMax [ 1 ] > dim [ 0 ] ) { minMax [ 1 ] = dim [ 0 ] ; } if ( minMax [ 2 ] < 0 ) { minMax [ 2 ] = 0 ; } if ( minMax [ 3 ] > dim [ 1 ] ) { minMax [ 3 ] = dim [ 1 ] ; } if ( minMax [ 4 ] < 0 ) { minMax [ 4 ] = 0 ; } if ( minMax [ 5 ] > dim [ 2 ] ) { minMax [ 5 ] = dim [ 2 ] ; } return minMax ; }
Method checks boundaries.

@param minMax with minMax values
@param dim    dimension
@return new minMax values between 0 and dim