Java Integer Format format(int intval)

Here you can find the source of format(int intval)

Description

format

License

Open Source License

Declaration

private static String format(int intval) 

Method Source Code

//package com.java2s;

public class Main {
    private static String format(int intval) {
        String formatted = Integer.toHexString(intval);
        StringBuffer buf = new StringBuffer("00000000");
        buf.replace(8 - formatted.length(), 8, formatted);
        return buf.toString();
    }//from  w w  w . jav  a2 s .co  m

    private static String format(short shortval) {
        String formatted = Integer.toHexString(shortval);
        StringBuffer buf = new StringBuffer("0000");
        buf.replace(4 - formatted.length(), 4, formatted);
        return buf.toString();
    }
}

Related

  1. convertInt2Percent(int num)
  2. format(int c)
  3. format(int color)
  4. format(int i, int fillLength)
  5. format(int i, int length, boolean left_justify, char fill)
  6. format(int num)
  7. format(int num, int length)
  8. format(int spaces, String string)
  9. format(int ticks)