Java Byte Array Create toBytesWithLengthLong(byte[] buffer, int pos, byte[] bytes)

Here you can find the source of toBytesWithLengthLong(byte[] buffer, int pos, byte[] bytes)

Description

to Bytes With Length Long

License

Apache License

Declaration

public static int toBytesWithLengthLong(byte[] buffer, int pos, byte[] bytes) 

Method Source Code

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

public class Main {
    public static int toBytesWithLengthLong(byte[] buffer, int pos, byte[] bytes) {
        buffer[pos] = (byte) (bytes.length >> 24);
        buffer[pos + 1] = (byte) ((bytes.length >> 16) & 255);
        buffer[pos + 2] = (byte) ((bytes.length >> 8) & 255);
        buffer[pos + 3] = (byte) (bytes.length & 255);
        System.arraycopy(bytes, 0, buffer, pos + 4, bytes.length);
        return pos + bytes.length + 4;
    }//from   w w  w  .j a v  a  2  s.c o  m
}

Related

  1. toByteString(byte[] bytes, String seperator)
  2. toByteString(byte[] content, int len)
  3. toByteString(final byte[] b)
  4. toByteString(final String source)
  5. toBytesWithLength(byte[] buffer, int pos, String string)