<commit_before>/*
 * Copyright <NAME> 2009-2011, All rights reserved.
 *
 */
package net.domesdaybook.matcher.sequence;

/**
 *
 * @author <NAME>
 */
public class Utilities {

    public static String bytesToString(final boolean prettyPrint, byte[] bytes) {
        final int QUOTE_CHARACTER_VALUE = 39; // 34;
        StringBuilder hexString = new StringBuilder();
        boolean inString = false;
        for (int byteIndex=0, byteLength = bytes.length; byteIndex<byteLength; byteIndex++) {
            int byteValue = 0xFF & bytes[byteIndex];
            if ( prettyPrint && byteValue > 31 && byteValue < 127 &&
                 byteValue != QUOTE_CHARACTER_VALUE) {
                final String formatString = inString? "%c" : " '%c";
                hexString.append( String.format( formatString, (char) byteValue ));
                inString = true;
            } else {
                 final String formatString = prettyPrint? inString? "' %02x" : "%02x" : "%02x";
                hexString.append( String.format(formatString, byteValue ));
                inString = false;
            }
        }
        if ( prettyPrint && inString ) {
            hexString.append( "' ");
        }
        return hexString.toString();
    }
<commit_msg>tidy ups.<commit_after>/*
 * Copyright <NAME> 2009-2011, All rights reserved.
 *
 */
package net.domesdaybook.matcher.sequence;

/**
 *
 * @author <NAME>
 */
public class Utilities {

    public static String bytesToString(final boolean prettyPrint, byte[] bytes) {
        final int QUOTE_CHARACTER_VALUE = 39; // 34;
        StringBuilder hexString = new StringBuilder();
        boolean inString = false;
        for (int byteIndex=0, byteLength = bytes.length; byteIndex<byteLength; byteIndex++) {
            int byteValue = 0xFF & bytes[byteIndex];
            if ( prettyPrint && byteValue > 31 && byteValue < 127 &&
                 byteValue != QUOTE_CHARACTER_VALUE) {
                final String formatString = inString? "%c" : " '%c";
                hexString.append( String.format( formatString, (char) byteValue ));
                inString = true;
            } else {
                 final String formatString = prettyPrint? inString? "' %02x" : "%02x" : "%02x";
                hexString.append( String.format(formatString, byteValue ));
                inString = false;
            }
        }
        if (prettyPrint && inString) {
            hexString.append( "' ");
        }
        return hexString.toString();
    }

{'fraction_non_alphanumeric': 0.11818910256410256, 'fraction_numerical': 0.020032051282051284, 'mean_word_length': 2.071340713407134, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5390884', 'n_tokens_mistral': 729, 'n_tokens_neox': 668, 'n_words': 173}