Just to provide an answer, so we can mark it as answered:
Instead of manually parsing the GIF structure, the easiest way of getting the data from the GIF image descriptor in Java is using ImageIO.
For simple values like image width and height, you can use the corresponding methods on ImageReader
like this:
ImageInputStream stream = ImageIO.createImageInputStream(gif); // gif is File or InputStream
ImageReader reader = ImageIO.getImageReaders(stream).next();
reader.setInput(stream);
int w = reader.getWidth(0);
int h = reader.getHeight(0);
For more information on the GIF, you can use:
IIOMetadata metadata = reader.getImageMetadata(0);
For native metadata format, see GIF metadata, for standard (format neutral) metadata format, see standard metadata.