You can use Apache Commons Sanselan library to get image info: http://commons.apache.org/imaging/index.html.
final ImageInfo imageInfo = Sanselan.getImageInfo(file_);
final int physicalWidthDpi = imageInfo.getPhysicalWidthDpi();
final int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();