public void setDimensions(int dimensionCount, int dimensionNumBytes) {
    if (dimensionCount < 0) {
      throw new IllegalArgumentException("dimensionCount must be >= 0; got " + dimensionCount);
    }
    if (dimensionCount > PointValues.MAX_DIMENSIONS) {
      throw new IllegalArgumentException("dimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dimensionCount);
    }
    if (dimensionNumBytes < 0) {
      throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
    }
    if (dimensionCount > PointValues.MAX_NUM_BYTES) {
      throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
    }
    if (dimensionCount == 0) {
      if (dimensionNumBytes != 0) {
        throw new IllegalArgumentException("when dimensionCount is 0, dimensionNumBytes must 0; got " + dimensionNumBytes);
      }
    } else if (dimensionNumBytes == 0) {
      if (dimensionCount != 0) {
        throw new IllegalArgumentException("when dimensionNumBytes is 0, dimensionCount must 0; got " + dimensionCount);
      }
    }

    this.dimensionCount = dimensionCount;
    this.dimensionNumBytes = dimensionNumBytes;
  }