// // GDBytes.java // // // Created by Gene Davis on Sat Aug 18 2001. // Copyright (c) 2001 Gene Davis. I hereby release this code to the public domain. // It is now in every sense of the word Freeware. Future versions can be found // at http://www.genedavis.com/library/ // // version 1.0 package com.genedavis.util; public class GDBytes { /** * Turns a signed byte, represented as a byte primative, into an unsigned byte, represented by an int. * * @param b a primative byte to be converted to an unsigned byte. * * @return int representing a signed byte. */ public static int signedByteToUnsignedByte(byte b) { return (0xff & b); } /** * Turns an unsigned byte, represented as an int primative, into an signed byte, represented by an byte primative. * * @param i a primative int to be converted to a signed byte. * * @return byte in java is always signed. */ public static byte unsignedByteToSignedByte(int i) { return (byte) i; } }