Sparse matrix and its representations in java