Here you can find the source of unsignedToSigned(int[] ints)
Parameter | Description |
---|---|
ints | an array of signed bytes |
public static byte[] unsignedToSigned(int[] ints)
//package com.java2s; /*/*from w w w.j av a2 s . c om*/ * $Id$ * * Copyright (c) 2008-2014 David Muller <roxon@users.sourceforge.net>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ public class Main { /** * Convert an unsigned set of bytes to a signed set. * * @param ints an array of signed bytes * @return an array of unsigned bytes */ public static byte[] unsignedToSigned(int[] ints) { final byte[] result = new byte[ints.length]; for (int i = 0; i < ints.length; i++) { result[i] = (byte) (ints[i] & 0xFF); } return result; } }