Java Int64 Convert int64_to_buf(byte buf[], int pos, long value)

Here you can find the source of int64_to_buf(byte buf[], int pos, long value)

Description

intbuf

License

Open Source License

Declaration

public static void int64_to_buf(byte buf[], int pos, long value) 

Method Source Code

//package com.java2s;
/**/* w w  w  .  ja  va2 s. co m*/
 * Tencent is pleased to support the open source community by making MSEC available.
 *
 * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
 *
 * Licensed under the GNU General Public 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
 *
 *     https://opensource.org/licenses/GPL-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 {
    public static void int64_to_buf(byte buf[], int pos, long value) {
        buf[pos + 7] = (byte) (value >> 0);
        buf[pos + 6] = (byte) (value >> 8);
        buf[pos + 5] = (byte) (value >> 16);
        buf[pos + 4] = (byte) (value >> 24);
        buf[pos + 3] = (byte) (value >> 32);
        buf[pos + 2] = (byte) (value >> 40);
        buf[pos + 1] = (byte) (value >> 48);
        buf[pos + 0] = (byte) (value >> 56);
    }
}

Related

  1. int64(Object value)
  2. Int642Bytes(long sour)
  3. int64d(byte[] buf, int off)
  4. int64ToByteArray(long value, int size)
  5. int64toInt32(long key)