code: public void set(int index, float value)
      {
          if (index < offset + array.length && index >= offset)
          {
              array[index - offset] += value;
          }
          else if (index < offset)
          {  //expand from left
              int gap = offset - index;
              int newSize = gap + array.length;
              float[] newArray = new float[newSize];
              newArray[0] = value;
              for (int i = 0; i < array.length; i++)
              {
                  newArray[gap + i] = array[i];
              }
              this.offset = index;
              this.array = newArray;
          }
          else
          {
              int gap = index - (array.length + offset - 1);
              int newSize = array.length + gap;
              float[] newArray = new float[newSize];
              newArray[newSize - 1] = value;
              for (int i = 0; i < array.length; i++)
              {
                  newArray[i] = array[i];
              }
              this.array = newArray;
          }
      }
docs: 将index处的元素设置为value
  
  @param index
  @param value