<commit_before>package org.oddox.config;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Properties;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.regex.Pattern;

/**
 * A simple utility class that contains common methods used across classes.
 * 
 * @author <NAME>
 * @date 4/8/2017
 */
public class Utils {

    private static final DecimalFormat BYTEFORM = new DecimalFormat("0.00");
    private static final DateFormat READABLEDATEFORM = new SimpleDateFormat("MMM dd, yyyy");
    private static final DateFormat READABLEDATETIMEFORM = new SimpleDateFormat("MMM dd, yyyy (h:mm a z)");
    private static final DateFormat SQLSERVERDATEFORM = new SimpleDateFormat("yyyyMMdd hh:mm:ss a");
    private static final DateFormat ISO8601FORM = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    private static final DateFormat RFC1123FORM = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
    private static final Pattern EMAIL_PATTERN = Pattern
            .compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
    private static final NavigableMap<Long, String> suffixes = new TreeMap<>();    

    static {
        suffixes.put(1_000L, "k");
        suffixes.put(1_000_000L, "M");
        suffixes.put(1_000_000_000L, "B");
        suffixes.put(1_000_000_000_000L, "T");
        suffixes.put(1_000_000_000_000_000L, "P");
        suffixes.put(1_000_000_000_000_000_000L, "E");
    }

    static {
        ISO8601FORM.setTimeZone(TimeZone.getTimeZone("UTC"));
        RFC1123FORM.setTimeZone(TimeZone.getTimeZone("GMT"));
    }

    /**
     * Gets the current time in a readable format. "MMM dd, yyyy (h:mm a z)"
     * 
     * @return String
     */
    public static String getDate() {
        return formatReadableDate(new Date(System.currentTimeMillis()));
    }

    /**
     * Gets the current time in ISO 8601 format. "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
     * 
     * @return String
     */
    public static String getDateIso8601() {
        return formatIso8601Date(new Date(System.currentTimeMillis()));
    }

    /**
     * Gets the current time in RFC 1123 format. "EEE, dd MMM yyyy HH:mm:ss z"
     * 
     * @return String
     */<commit_msg>Fix Utils to be singleton<commit_after>package org.oddox.config;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Properties;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.regex.Pattern;

/**
 * A simple utility class that contains common methods used across classes.
 * 
 * @author <NAME>
 * @date 4/8/2017
 */
public final class Utils {

    private static final DecimalFormat BYTEFORM = new DecimalFormat("0.00");
    private static final DateFormat READABLEDATEFORM = new SimpleDateFormat("MMM dd, yyyy");
    private static final DateFormat READABLEDATETIMEFORM = new SimpleDateFormat("MMM dd, yyyy (h:mm a z)");
    private static final DateFormat SQLSERVERDATEFORM = new SimpleDateFormat("yyyyMMdd hh:mm:ss a");
    private static final DateFormat ISO8601FORM = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    private static final DateFormat RFC1123FORM = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
    private static final Pattern EMAIL_PATTERN = Pattern
            .compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
    private static final NavigableMap<Long, String> suffixes = new TreeMap<>();    

    static {
        suffixes.put(1_000L, "k");
        suffixes.put(1_000_000L, "M");
        suffixes.put(1_000_000_000L, "B");
        suffixes.put(1_000_000_000_000L, "T");
        suffixes.put(1_000_000_000_000_000L, "P");
        suffixes.put(1_000_000_000_000_000_000L, "E");
        ISO8601FORM.setTimeZone(TimeZone.getTimeZone("UTC"));
        RFC1123FORM.setTimeZone(TimeZone.getTimeZone("GMT"));
    }
    
    private Utils() {
        // prevent instantiation
    }

    /**
     * Gets the current time in a readable format. "MMM dd, yyyy (h:mm a z)"
     * 
     * @return String
     */
    public static String getDate() {
        return formatReadableDate(new Date(System.currentTimeMillis()));
    }

    /**
     * Gets the current time in ISO 8601 format. "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
     * 
     * @return String
     */
    public static String getDateIso8601() {
        return formatIso8601Date(new Date(System.currentTimeMillis()));
    }

    /**
     * Gets the current time in RFC 1123 format. "EEE, dd MMM yyyy HH:mm:ss z"
     * 
     * @return String
     */
{'fraction_non_alphanumeric': 0.13297872340425532, 'fraction_numerical': 0.04521276595744681, 'mean_word_length': 3.3875, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1776422', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1783, 'n_words': 408}