Java Long to long2longArr(long val, long[] res)

Here you can find the source of long2longArr(long val, long[] res)

Description

longlong Arr

License

Open Source License

Declaration

public static long[] long2longArr(long val, long[] res) 

Method Source Code

//package com.java2s;
/*/*ww  w.  ja v  a2 s  . co  m*/
 sopc2dts - Devicetree generation for Altera systems

 Copyright (C) 2012 - 2014 Walter Goossens <waltergoossens@home.nl>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

public class Main {
    public static long[] long2longArr(long val, long[] res) {
        if (res.length == 1) {
            res[0] = val & 0xFFFFFFFFL;
        } else if (res.length > 1) {
            res[res.length - 2] = (val >> 32) & 0xFFFFFFFFL;
            res[res.length - 1] = val & 0xFFFFFFFFL;
            for (int i = 0; i < res.length - 2; i++) {
                res[i] = 0;
            }
        }
        return res;
    }
}

Related

  1. long2Date(Long date, String interval)
  2. long2dotted(long address)
  3. long2FourChars(long i)
  4. Long2H(final long l)
  5. long2leb(final long x, final byte[] buf, final int offset)
  6. long2MacAddress(long l)
  7. long2minLeb(final long x)
  8. longTo36Str(String str)
  9. longTo4ByteArray(byte[] bytes, int offset, long value)