You can't. You can only determine for which version of the JVM the code was compiled. Generally, javac will generate bytecode for the JVM version that it shipped with (i.e., javac in Java 5 will create Java 5 bytecode), but that can be changed using the -source and -target switches.
Bytes 5 through 8 of a class file contain the minor and major class file version (i.e., the one specified by the "-target" switch). Some more detail can be found here.
Here's a small program that shows the class file version number. However, the class file version number is not the same as the JDK version number with which it is compiled.
For Java 1.4, you'll get 48.0, for Java 5 you'll get 49.0 and for Java 6 you'll get 50.0. But as Ulf already said, you can also create version 48.0 and 49.0 files with the compiler in JDK 6, if you use the -source and -target switches.
[ August 16, 2007: Message edited by: Jesper Young ]