code: public void set(int i, double value) {
          switch (i) {
              case 0: {
                  x = value;
                  break;
              }
              case 1: {
                  y = value;
                  break;
              }
              case 2: {
                  z = value;
                  break;
              }
              default: {
                  throw new ArrayIndexOutOfBoundsException(i);
              }
          }
      }
docs: Sets a single element of this vector. Elements 0, 1, and 2 correspond to
  x, y, and z.
  
  @param i
  element index
  @param value
  element value
  @return element value throws ArrayIndexOutOfBoundsException if i is not
  in the range 0 to 2.