Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2012feb10 Language: Java Q. How can I convert a byte to a long A. You probably want to AND with 0xff to avoid sign extension:long mylong = mybyte & 0xff;Similarly when going to an int:int myint = mybyte & 0xff;
Add a commentSign in to add a comment