Java Integer to Byte intTo1Byte(int x)

Here you can find the source of intTo1Byte(int x)

Description

int To Byte

License

Open Source License

Parameter

Parameter Description
x a parameter

Return

intTo1Byte

Declaration

public static byte[] intTo1Byte(int x) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2015 Orange./*from  ww  w.  j  ava2  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 intTo1Byte
     */
    public static byte[] intTo1Byte(int x) {
        byte[] out = new byte[1];
        out[0] = (byte) (x & 0xff);
        return out;
    }
}

Related

  1. int2byteArray(int[] i)
  2. int2ByteArrayLength4(int theInt)
  3. int2ToByteArray(int value)
  4. int2ubyte(int in)
  5. intAsByte(int value)
  6. intTo4Byte(int i)
  7. intToByte(byte[] buf, int off, int value)
  8. intToByte(final int i)
  9. intToByte(int i)