How do i use a variable to press a key with robot class

Yea i dont really do too so
I need a function to press the button i need which will do something like this

void SendKey(String KeyINeed, Robot robot) {
  robot.keyPress(KeyEvent.VK_(key);
  robot.keyRelease(KeyEvent.VK_(key);
}

so pressing a key and releasing it