code: private void readSparseInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
          double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
          double y = Double.NaN;
          int index = -1;
          
          // Get values for all attributes.
          do {
              getNextToken(tokenizer);
              
              // end of instance
              if (tokenizer.ttype == '}') {
                  break;
              }
              
              String s = tokenizer.sval.trim();
              if (index < 0) {
                  index = Integer.parseInt(s);
                  if (index < 0 || index >= attributes.length) {
                      throw new ParseException("Invalid attribute index: " + index, tokenizer.lineno());
                  }
                  
              } else {
                  
                  String val = s;
                  if (index != responseIndex) {
                      if (val.equals("?")) {
                          x[index] = Double.NaN;
                      } else {
                          x[index] = attributes[index].valueOf(val);
                      }
                  } else {
                      if (val.equals("?")) {
                          y = Double.NaN;
                      } else {
                          y = attributes[index].valueOf(val);
                      }
                  }
                  
                  index = -1;
              }
              
          } while (tokenizer.ttype == StreamTokenizer.TT_WORD);
          
          if (Double.isNaN(y)) data.add(x); else data.add(x, y);
      }
docs: Reads a sparse instance using the tokenizer.
  @throws ParseException if the information is not read successfully