static String preview(byte[] data, int length) {
        int previewLength = Math.min(MAX_ARRAY_PREVIEW, Math.max(length, 0));
        byte[] dataRange = Arrays.copyOfRange(data, 0, previewLength);
        String preview = Arrays.toString(dataRange);
        if (previewLength < length) {
            preview = preview.substring(0, preview.length() - 1) + ", ...]";
        }
        return preview;
    }
Just simple utils.

@author Alexey Danilov (danikula@gmail.com).
dkplayer-videocache/src/main/java/com/danikula/videocache/ProxyCacheUtils.java