class SparseVector extends Vector {

    public void removeZeroValues() {
        if (this.values.length != 0) {
            List<Integer> idxs = new ArrayList<>();
            for (int i = 0; i < values.length; i++) {
                if (0 != values[i]) {
                    idxs.add(i);
                }
            }
            int[] newIndices = new int[idxs.size()];
            double[] newValues = new double[newIndices.length];
            for (int i = 0; i < newIndices.length; i++) {
                newIndices[i] = indices[idxs.get(i)];
                newValues[i] = values[idxs.get(i)];
            }
            this.indices = newIndices;
            this.values = newValues;
        }
    }

    public  SparseVector();
    public  SparseVector(int n);
    public  SparseVector(int n, int[] indices, double[] values);
    public  SparseVector(int n, Map<Integer, Double> kv);

}