public byte[] serialize() throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  DataOutputStream oos=new DataOutputStream(baos);
  oos.writeBoolean(sorted);
  oos.writeInt(indices.length);
  for (int i=0; i < indices.length; i++) {
    oos.writeInt(indices[i]);
    oos.writeFloat(values[i]);
  }
  oos.flush();
  return baos.toByteArray();
}

public byte [ ] serialize ( ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; DataOutputStream oos = new DataOutputStream ( baos ) ; oos . writeBoolean ( sorted ) ; oos . writeInt ( indices . length ) ; for ( int i = 0 ; i < indices . length ; i ++ ) { oos . writeInt ( indices [ i ] ) ; oos . writeFloat ( values [ i ] ) ; } oos . flush ( ) ; return baos . toByteArray ( ) ; }
serialize the feature vector
