code: public double[] toArray() {
          if (vectorOffset > 0 || vectorLength != vector.length()) {
              double[] r = new double[vectorLength - vectorOffset];
              for (int i = vectorOffset; i < vectorLength; ++i)
                  r[i] = doubleVector.get(i);
              return r;
          }
          else
              return doubleVector.toArray();
      }
docs: {@inheritDoc}