Java Byte to Byte Array byteToBytes(byte x)

Here you can find the source of byteToBytes(byte x)

Description

byte To Bytes

License

Open Source License

Parameter

Parameter Description
x a parameter

Return

a byte[] collection from a single byte

Declaration

public static byte[] byteToBytes(byte x) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2015 Orange./*from   w  w w  .ja va2  s .c o  m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Victor PERRON, Antonin CHAZALET, Andre BOTTARO.
 *******************************************************************************/

public class Main {
    /**
     * @param x
     * @return a byte[] collection from a single byte
     */
    public static byte[] byteToBytes(byte x) {
        byte[] out = new byte[1];
        out[0] = x;
        return out;
    }
}

Related

  1. byteToByte(byte[] in)
  2. byteToByteArray(byte number)
  3. byteToBytes(byte src)