private static boolean isImage ( String hexString ) { boolean isImage = false ; //png if ( hexString . startsWith ( "89504e470d0a1a0a" ) ) { isImage = true ; //gif } else if ( hexString . startsWith ( "474946383761" ) || hexString . startsWith ( "474946383961" ) ) { isImage = true ; // jpeg } else if ( hexString . startsWith ( "ffd8ffe0" ) ) { isImage = true ; } return isImage ; }
JPEGs start with FF D8 FF E0 xx xx 4A 46 49 46 00