public ArrayList<Double> DwtZigzag(double[][] _pic, int _N, int _x, int _y, int _numCofficient) {
        //if _numCofficient is bigger than the whole picture, output the whole picture.
        if (_numCofficient > _N * _N) {
            _numCofficient = _N * _N;
        }

        if (_numCofficient <= 0) {
            ArrayList<Double> _tem = new ArrayList<Double>(); //_tem is empty
            return _tem;
        } else if (_N == 1) {
            _numCofficient -= 1;
            ArrayList<Double> _tem = new ArrayList<Double>();
            _tem.add(new Double(_pic[_x][_y]));
            return _tem;
        } else {
            // split array to 4 parts
            /*_______
            * |LL|LH|
            * |--|--|
            * |HL|HH|
            * |--|--|
            */
            ArrayList<Double> _result = new ArrayList<Double>();
            _result = DwtZigzag(_pic, _N / 2, _x, _y, _numCofficient);
            _numCofficient -= (_N / 2) * (_N / 2);
            _result.addAll(DwtZigzag(_pic, _N / 2, _x + _N / 2, _y, _numCofficient));
            _numCofficient -= (_N / 2) * (_N / 2);
            _result.addAll(DwtZigzag(_pic, _N / 2, _x, _y + _N / 2, _numCofficient));
            _numCofficient -= (_N / 2) * (_N / 2);
            _result.addAll(DwtZigzag(_pic, _N / 2, _x + _N / 2, _y + _N / 2, _numCofficient));
            _numCofficient -= (_N / 2) * (_N / 2);

            return _result;
        }
    }