<commit_before>package com.ae.apps.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class CommonUtils {

	public static final int	MINIMUM_STRING_LENGTH	= 26;

	/**
	 * Formats a timestamp as required
	 * 
	 * @param timestamp
	 * @return
	 */
	public static String formatTimeStamp(String timestamp, String pattern) {
		String lastContactedTimeString = "Never";
		if (timestamp != null && timestamp.trim().length() > 0) {
			long tempLastContacted = Long.parseLong(timestamp);
			if (tempLastContacted > 0) {
				SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
				Date date = new Date(Long.parseLong(timestamp));
				lastContactedTimeString = dateFormat.format(date);
			}
		}
		return lastContactedTimeString;
	}

	/**
	 * Well, truncates the given string if length greater than MINIMUM_STRING_LENGTH with an ellipsis
	 * 
	 * @param sourceString
	 * @return
	 */
	public static String truncateString(String sourceString) {<commit_msg>Using default locale for date format<commit_after>package com.ae.apps.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class CommonUtils {

	public static final int	MINIMUM_STRING_LENGTH	= 26;

	/**
	 * Formats a timestamp as required
	 * 
	 * @param timestamp
	 * @return
	 */
	public static String formatTimeStamp(String timestamp, String pattern) {
		String lastContactedTimeString = "Never";
		if (timestamp != null && timestamp.trim().length() > 0) {
			long tempLastContacted = Long.parseLong(timestamp);
			if (tempLastContacted > 0) {
				SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.getDefault());
				Date date = new Date(Long.parseLong(timestamp));
				lastContactedTimeString = dateFormat.format(date);
			}
		}
		return lastContactedTimeString;
	}

	/**
	 * Well, truncates the given string if length greater than MINIMUM_STRING_LENGTH with an ellipsis
	 * 
	 * @param sourceString
	 * @return
	 */
	public static String truncateString(String sourceString) {
{'fraction_non_alphanumeric': 0.09601181683899557, 'fraction_numerical': 0.003938946331856229, 'mean_word_length': 4.319371727748691, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '829385', 'n_tokens_mistral': 655, 'n_tokens_neox': 579, 'n_words': 162}