common_helper/src/main/java/com/xiongyingqi/util/FileType.java
private static String bytesToHexString(byte[] src){
        StringBuilder stringBuilder = new StringBuilder();
        if(null==src || src.length <= 0){
            return null;
        }
        for(int i = 0; i < src.length; i++){
            int v = src[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if(hv.length() < 2){
                stringBuilder.append(0);
            }
            stringBuilder.append(hv);
        }
        return stringBuilder.toString();
    }
private static String bytesToHexString(byte[] src){
        StringBuilder stringBuilder = new StringBuilder();
        if(null==src || src.length <= 0){
            return null;
        }
        for(int i = 0; i < src.length; i++){
            int v = src[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if(hv.length() < 2){
                stringBuilder.append(0);
            }
            stringBuilder.append(hv);
        }
        return stringBuilder.toString();
    }
private static String bytesToHexString ( byte [ ] src ) { StringBuilder stringBuilder = new StringBuilder ( ) ; if ( null == src || src . length <= 0 ) { return null ; } for ( int i = 0 ; i < src . length ; i ++ ) { int v = src [ i ] & 0xFF ; String hv = Integer . toHexString ( v ) ; if ( hv . length ( ) < 2 ) { stringBuilder . append ( 0 ) ; } stringBuilder . append ( hv ) ; } return stringBuilder . toString ( ) ; }
得到上传文件的文件头
@param src
@return
得到上传文件的文件头