Java Long to longToBuffer(long l, byte[] ioBuffer)

Here you can find the source of longToBuffer(long l, byte[] ioBuffer)

Description

long To Buffer

License

Open Source License

Declaration

public static void longToBuffer(long l, byte[] ioBuffer) 

Method Source Code

//package com.java2s;
/*//from   ww  w. j  ava 2s .  c  o m
 * ao-lang - Minimal Java library with no external dependencies shared by many other projects.
 * Copyright (C) 2011, 2012, 2013, 2015, 2016, 2017  AO Industries, Inc.
 *     support@aoindustries.com
 *     7262 Bull Pen Cir
 *     Mobile, AL 36695
 *
 * This file is part of ao-lang.
 *
 * ao-lang 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 3 of the License, or
 * (at your option) any later version.
 *
 * ao-lang 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 ao-lang.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static void longToBuffer(long l, byte[] ioBuffer) {
        ioBuffer[0] = (byte) (l >>> 56);
        ioBuffer[1] = (byte) (l >>> 48);
        ioBuffer[2] = (byte) (l >>> 40);
        ioBuffer[3] = (byte) (l >>> 32);
        ioBuffer[4] = (byte) (l >>> 24);
        ioBuffer[5] = (byte) (l >>> 16);
        ioBuffer[6] = (byte) (l >>> 8);
        ioBuffer[7] = (byte) l;
    }

    public static void longToBuffer(long l, byte[] ioBuffer, int off) {
        ioBuffer[off] = (byte) (l >>> 56);
        ioBuffer[off + 1] = (byte) (l >>> 48);
        ioBuffer[off + 2] = (byte) (l >>> 40);
        ioBuffer[off + 3] = (byte) (l >>> 32);
        ioBuffer[off + 4] = (byte) (l >>> 24);
        ioBuffer[off + 5] = (byte) (l >>> 16);
        ioBuffer[off + 6] = (byte) (l >>> 8);
        ioBuffer[off + 7] = (byte) l;
    }
}

Related

  1. longToBinary(long num)
  2. longtobinarystring(long wert, int bits)
  3. longToBinaryStringUnsigned(long value)
  4. longToBucket(long key, int buckets)
  5. LongToBuf4(long val, byte[] buf, int offset)
  6. longToCharArray(long seat, int length)
  7. longToCharBounds(long value)
  8. longToCompare(Long value)
  9. longToDB(long val)