Java Integer to int2TwoChars(int i)

Here you can find the source of int2TwoChars(int i)

Description

Converts an int into an array of two characters with the high bits in the first element and the low bits in the second element

License

LGPL

Parameter

Parameter Description
i a parameter

Declaration

public static char[] int2TwoChars(int i) 

Method Source Code

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

public class Main {
    /**//from w w w  .j a  va2s .c  o m
     * Converts an int into an array of two characters with the high bits
     * in the first element and the low bits in the second element
     * @param i
     * @return
     */
    public static char[] int2TwoChars(int i) {
        char[] asChars = new char[2];
        asChars[0] = (char) (i >>> 16);
        asChars[1] = (char) (i & 0xFFFF);
        return asChars;
    }
}

Related

  1. int2minBeb(final int x)
  2. int2path(int v)
  3. int2rgb(final int color)
  4. Int2Short(int i)
  5. int2sortableStr(int val)
  6. intTo2LengthBytes(int i)
  7. intTo2UnsignedBytes(int val)
  8. intTo8HexString(int i)
  9. intToAlgebraicLoc(int loc)