Java Integer to int2sortableStr(int val)

Here you can find the source of int2sortableStr(int val)

Description

intsortable Str

License

Apache License

Declaration

public static String int2sortableStr(int val) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String int2sortableStr(int val) {
        char[] arr = new char[3];
        int2sortableStr(val, arr, 0);
        return new String(arr, 0, 3);
    }//ww w  . ja v a2s . c  o  m

    public static String int2sortableStr(String val) {
        return int2sortableStr(Integer.parseInt(val));
    }

    public static int int2sortableStr(int val, char[] out, int offset) {
        val += Integer.MIN_VALUE;
        out[offset++] = (char) (val >>> 24);
        out[offset++] = (char) ((val >>> 12) & 0x0fff);
        out[offset++] = (char) (val & 0x0fff);
        return 3;
    }
}

Related

  1. int2Integer(int[] array)
  2. int2minBeb(final int x)
  3. int2path(int v)
  4. int2rgb(final int color)
  5. Int2Short(int i)
  6. int2TwoChars(int i)
  7. intTo2LengthBytes(int i)
  8. intTo2UnsignedBytes(int val)
  9. intTo8HexString(int i)