final ByteArrayInputStream is = new ByteArrayInputStream(imageData);
try {
final int segmentLength = read2Bytes("segmentLength", is, "Not a Valid JPEG File", getByteOrder());
final byte[] sosSegmentBytes = readBytes("SosSegment",
is, segmentLength - 2, "Not a Valid JPEG File");
sosSegment = new SosSegment(marker, sosSegmentBytes);
int hMax = 0;
int vMax = 0;
for (int i = 0; i < sofnSegment.numberOfComponents; i++) {
hMax = Math.max(hMax,