Java Utililty Methods Integer Format

List of utility methods to do Integer Format

  1. HOME
  2. Java
  3. I
  4. Integer Format

Description

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

Method

double convertInt2Percent(int num)
convert Int Percent
DecimalFormat decimalFormat = new DecimalFormat("0.00");
String ret = decimalFormat.format(Double.valueOf("0." + num));
return Double.valueOf(ret);
String format(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!";
String format(int color)
format
return '#' + Integer.toHexString(0xFFFFFF & color);
String format(int i, int fillLength)
format
return format(Integer.toString(i), fillLength, defaultSplitChar, ALIGN_RIGHT);
String format(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);
String format(int intval)
format
String formatted = Integer.toHexString(intval);
StringBuffer buf = new StringBuffer("00000000");
buf.replace(8 - formatted.length(), 8, formatted);
return buf.toString();
String format(int num)
format
return (num < 10 ? "0" : "") + num;
String format(int num, int length)
format
String str = Integer.toHexString(num);
return format(str, length);
String format(int spaces, String string)
format
String format = "%1$-" + spaces + "s";
return String.format(format, string);
String format(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();


AltStyle によって変換されたページ (->オリジナル) /