Java Long to Byte Array longToBytesPlus8(byte[] p, long v)

Here you can find the source of longToBytesPlus8(byte[] p, long v)

Description

long To Bytes Plus

License

Apache License

Declaration

static void longToBytesPlus8(byte[] p, long v) 

Method Source Code

//package com.java2s;
/*//from w w  w.java 2  s. com
 * Copyright (c) 2016 Pando Software Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

public class Main {
    static void longToBytesPlus8(byte[] p, long v) {
        p[8] = (byte) v;
        p[9] = (byte) (v >>> 8);
        p[10] = (byte) (v >>> 16);
        p[11] = (byte) (v >>> 24);
        p[12] = (byte) (v >>> 32);
        p[13] = (byte) (v >>> 40);
        p[14] = (byte) (v >>> 48);
        p[15] = (byte) (v >>> 56);
    }
}

Related

  1. LongToBytes4(long l, byte abyte0[])
  2. LongToBytes8(long l)
  3. LongToBytesLE(final long val)
  4. longToBytesLE(long value, byte[] buffer)
  5. longToBytesLE(long value, byte[] buffer, int offset, int length)