You can't do it from the console from native Java. System.in is line-buffered; you see no characters until Enter is pressed -- and then you only see the Unicode for the actual plaintext characters.
You can get key codes in a GUI window, though (AWT or Swing.)