public void hold(int key,int duration) throws InterruptedException {
  press(key);
  if (duration >= 0) {
    Thread.sleep(duration);
  }
  release(key);
}

public void hold ( int key , int duration ) throws InterruptedException { press ( key ) ; if ( duration >= 0 ) { Thread . sleep ( duration ) ; } release ( key ) ; }
hold a key for a certain duration
