Java Byte Array Create byteArrayFromInteger(int integer)

Here you can find the source of byteArrayFromInteger(int integer)

Description

byte Array From Integer

License

Open Source License

Declaration

public static byte[] byteArrayFromInteger(int integer) 

Method Source Code

//package com.java2s;
/**//from  ww  w .j  ava2 s  .  c om
 * This code is free software; you can redistribute it and/or modify it under
 * the terms of the new BSD License.
 *
 * Copyright (c) 2008-2009, Sebastian Staudt
 */

public class Main {
    public static byte[] byteArrayFromInteger(int integer) {
        return new byte[] { (byte) (integer >> 24), (byte) (integer >> 16),
                (byte) (integer >> 8), (byte) integer };
    }
}

Related

  1. byteArrayFromBytes(int... bytes)
  2. byteArrayFromChar(char i)
  3. byteArrayFromHexString(String in)
  4. byteArrayFromInt(final int number)
  5. byteArrayFromInteger(int integer)
  6. bytes(final byte... elements)
  7. bytes(final int... ints)
  8. bytes(int... bytes)
  9. bytes(int... ints)