Java Long to long2FourChars(long i)

Here you can find the source of long2FourChars(long i)

Description

Converts a long to a char array of four elements

License

LGPL

Parameter

Parameter Description
i a parameter

Declaration

public static char[] long2FourChars(long i) 

Method Source Code

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

public class Main {
    /**/*from   w w w  . ja  v  a 2  s  .co  m*/
     * Converts a long to a char array of four elements
     * @param i
     * @return
     */
    public static char[] long2FourChars(long i) {
        char[] asChars = new char[4];
        asChars[0] = (char) (i >>> 48);
        asChars[1] = (char) ((i >>> 32) & 0xFFFF);
        asChars[2] = (char) ((i >>> 16) & 0xFFFF);
        asChars[3] = (char) (i & 0xFFFF);
        return asChars;
    }
}

Related

  1. long2array(int sz, long seed)
  2. long2buff(long n)
  3. long2char(long x)
  4. long2Date(Long date, String interval)
  5. long2dotted(long address)
  6. Long2H(final long l)
  7. long2leb(final long x, final byte[] buf, final int offset)
  8. long2longArr(long val, long[] res)
  9. long2MacAddress(long l)