question: public static boolean isZip ( BufferedInputStream in ) { in . mark ( 4 ) ; byte [ ] b = new byte [ 4 ] ; byte [ ] zipSig = new byte [ 4 ] ; zipSig [ 0 ] = 0x50 ; zipSig [ 1 ] = 0x4b ; zipSig [ 2 ] = 0x03 ; zipSig [ 3 ] = 0x04 ; try { in . read ( b , 0 , 4 ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Couldn't read header from stream " , ex ) ; } try { in . reset ( ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Couldn't reset stream " , ex ) ; } return Arrays . equals ( b , zipSig ) ; }
target:  Test for ZIP stream signature.