There is no standard class to this, but it's actually fairly easy to write your own class to this.
All you need to do is get the specs for the different filetypes (bmp, gif, jpg, png) and locate the position of the height and width information in a file's structure.
For bmp generated with win95 & higher (integer, little endian):
width: bytes 19-22
height: bytes 23-26
For gif (short, little endian):
width: bytes 7+8
height: bytes 9+10
For png (integer, big endian):
width: bytes 17-20
height: bytes 21-24
For jpg (short, big endian) it gets a little more complicated; a jpg is set up of as a bunch of segments each segment has its own structure, meaning, and length. What you have to do is look for a segment which starts with 0xFFC0 and in that segment you'll find bytes 6+7 for height and 8+9 for width.
I'm currently implementing a class using this information, using the java.nio.ByteBuffer class for storage of the picture data.