code: public static Vector fromMatrixMarket(InputStream is) throws IOException {
  
          StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
          tokenizer.wordChars('%', '%');
  
          tokenizer.nextToken();
          if (!"%%MatrixMarket".equals(tokenizer.sval)) {
              throw new IllegalArgumentException("Wrong input file format: can not read header '%%MatrixMarket'.");
          }
  
          tokenizer.nextToken();
          String object = tokenizer.sval;
          if (!"vector".equals(object)) {
              throw new IllegalArgumentException("Unexpected object: " + object + ".");
          }
  
          tokenizer.nextToken();
          String format = tokenizer.sval;
          if (!"coordinate".equals(format) && !"array".equals(format)) {
              throw new IllegalArgumentException("Unknown format: " + format + ".");
          }
  
          tokenizer.nextToken();
          String field = tokenizer.sval;
          if (!"real".equals(field)) {
              throw new IllegalArgumentException("Unknown field type: " + field + ".");
          }
  
          tokenizer.nextToken();
          int length = (int) Math.round(tokenizer.nval);
          if ("coordinate".equals(format)) {
              tokenizer.nextToken();
              int cardinality = (int) Math.round(tokenizer.nval);
              Vector result = SparseVector.zero(length, cardinality);
  
              for (int k = 0; k < cardinality; k++) {
                  tokenizer.nextToken();
                  int i = (int) Math.round(tokenizer.nval);
                  tokenizer.nextToken();
                  double x = tokenizer.nval;
                  result.set(i - 1, x);
              }
  
              return result;
          } else {
              Vector result = DenseVector.zero(length);
  
              for (int i = 0; i < length; i++) {
                  tokenizer.nextToken();
                  result.set(i, tokenizer.nval);
              }
  
              return result;
          }
      }
docs: Parses {@link Vector} from the given Matrix Market.
  
  @param is the input stream in Matrix Market format
  
  @return a parsed vector
  @exception  IOException  if an I/O error occurs.