Here you can find the source of isJPEG(byte[] b)
private static boolean isJPEG(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { private static boolean isJPEG(byte[] b) { if (b.length < 2) { return false; }// www. ja v a 2s .c o m return (b[0] == (byte) 0xFF) && (b[1] == (byte) 0xD8); } }