Java Utililty Methods Integer Format

List of utility methods to do Integer Format

Description

The list of methods to do Integer Format are organized into topic(s).

Method

doubleconvertInt2Percent(int num)
convert Int Percent
DecimalFormat decimalFormat = new DecimalFormat("0.00");
String ret = decimalFormat.format(Double.valueOf("0." + num));
return Double.valueOf(ret);
Stringformat(int c)
Format character for debugging output, which it is prefixed with "0x", padded left with '0' and either 4 or 6 hex characters in width according to whether it is in the BMP or not.
if (c < 1114112) {
    return "0x" + padLeft(Integer.toString(c, 16), (c < 65536) ? 4 : 6, '0');
} else {
    return "!NOT A CHARACTER!";
Stringformat(int color)
format
return '#' + Integer.toHexString(0xFFFFFF & color);
Stringformat(int i, int fillLength)
format
return format(Integer.toString(i), fillLength, defaultSplitChar, ALIGN_RIGHT);
Stringformat(int i, int length, boolean left_justify, char fill)
Return a string for an integer justified left or right and filled up with `fill' characters if necessary.
return fillup(Integer.toString(i), length, left_justify, fill);
Stringformat(int intval)
format
String formatted = Integer.toHexString(intval);
StringBuffer buf = new StringBuffer("00000000");
buf.replace(8 - formatted.length(), 8, formatted);
return buf.toString();
Stringformat(int num)
format
return (num < 10 ? "0" : "") + num;
Stringformat(int num, int length)
format
String str = Integer.toHexString(num);
return format(str, length);
Stringformat(int spaces, String string)
format
String format = "%1$-" + spaces + "s";
return String.format(format, string);
Stringformat(int ticks)
format
int hours = ticks / 216000;
int minutes = ticks / 3600 % 60;
int seconds = ticks / 60 % 60;
int frames = ticks % 60;
SB.setLength(0);
if (hours < 10) {
    SB.append('0');
SB.append(hours);
SB.append(':');
if (minutes < 10) {
    SB.append('0');
SB.append(minutes);
SB.append(':');
if (seconds < 10) {
    SB.append('0');
SB.append(seconds);
SB.append(':');
if (frames < 10) {
    SB.append('0');
SB.append(frames);
return SB.toString();