code: int encodev(int best, float[] a, Buffer b) {
          for (int k = 0; k < dim; k++) {
              a[k] = valuelist[best * dim + k];
          }
          return (encode(best, b));
      }
docs: returns the number of bits and *modifies a* to the quantization value