Java Byte Create toByteBE(int value, byte[] dst, int offset)

Here you can find the source of toByteBE(int value, byte[] dst, int offset)

Description

int to 32bit

License

Open Source License

Declaration

public static final int toByteBE(int value, byte[] dst, int offset) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Jens Kristian Villadsen.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html/*from ww  w .  ja  v a 2 s  . c o m*/
 * 
 * Contributors:
 *     Jens Kristian Villadsen - Lead developer, owner and creator
 ******************************************************************************/

public class Main {
    /**
     * int to 32bit
     */
    public static final int toByteBE(int value, byte[] dst, int offset) {
        dst[offset] = (byte) ((value >> 24) & 0xFF);
        dst[++offset] = (byte) ((value >> 16) & 0xFF);
        dst[++offset] = (byte) ((value >> 8) & 0xFF);
        dst[++offset] = (byte) (value & 0xFF);
        return 4;
    }
}

Related

  1. toByte(String string)
  2. toByte(String string)
  3. toByte(String value)
  4. toByte(String value)
  5. toByte(T value)
  6. toByteByAddress(String address)
  7. toByteByHex(String address)
  8. toByteColor(int i)
  9. toByteFromBin(String binSymbols)