public void put(int key,double value){
  int i=binarySearch(mKeys,0,mSize,key);
  if (i >= 0) {
    mValues[i]=value;
  }
 else {
    i=~i;
    if (mSize >= mKeys.length) {
      int n=ArrayUtils.idealIntArraySize(mSize + 1);
      int[] nkeys=new int[n];
      double[] nvalues=new double[n];
      System.arraycopy(mKeys,0,nkeys,0,mKeys.length);
      System.arraycopy(mValues,0,nvalues,0,mValues.length);
      mKeys=nkeys;
      mValues=nvalues;
    }
    if (mSize - i != 0) {
      System.arraycopy(mKeys,i,mKeys,i + 1,mSize - i);
      System.arraycopy(mValues,i,mValues,i + 1,mSize - i);
    }
    mKeys[i]=key;
    mValues[i]=value;
    mSize++;
  }
}

public void put ( int key , double value ) { int i = binarySearch ( mKeys , 0 , mSize , key ) ; if ( i >= 0 ) { mValues [ i ] = value ; } else { i = ~ i ; if ( mSize >= mKeys . length ) { int n = ArrayUtils . idealIntArraySize ( mSize + 1 ) ; int [ ] nkeys = new int [ n ] ; double [ ] nvalues = new double [ n ] ; System . arraycopy ( mKeys , 0 , nkeys , 0 , mKeys . length ) ; System . arraycopy ( mValues , 0 , nvalues , 0 , mValues . length ) ; mKeys = nkeys ; mValues = nvalues ; } if ( mSize - i != 0 ) { System . arraycopy ( mKeys , i , mKeys , i + 1 , mSize - i ) ; System . arraycopy ( mValues , i , mValues , i + 1 , mSize - i ) ; } mKeys [ i ] = key ; mValues [ i ] = value ; mSize ++ ; } }
adds a mapping from the specified key to the specified value , replacing the previous mapping from the specified key if there was one .
