/*
 * @(#)Format.java
 *
 * Jörg Haeger, 16.01.2003
 */

/**
 * Format
 *
 * @version 20030121
 * @author Jörg P. M. Haeger
 */
class Format {
	static String left(String str, int width, char ch) {
		if (str.length() >= width)
			return str;
		char[] suffix = new char[width - str.length()];
		for (int i = 0; i < suffix.length; i++)
			suffix[i] = ch;
		return str + new String(suffix);
	}

	static String left(long n, int width, char ch) {
		return left(new Long(n).toString(), width, ch);
	}

	static String right(String str, int width, char ch) {
		if (str.length() >= width)
			return str;
		char[] prefix = new char[width - str.length()];
		for (int i = 0; i < prefix.length; i++)
			prefix[i] = ch;
		return new String(prefix).concat(str);
	}

	static String right(long n, int width, char ch) {
		return right(new Long(n).toString(), width, ch);
	}
}
