Sunday Feb 05
Move
Display 0 | 5 | 10 | 15 Stories

Software Tutorials

Topics
Top Story

How to Enable / Disable Autoformat in word 2007

How to Enable / Disable Autoformat in word 2007

  The interface of Office 2007 does does not offer an intuitive tool to enable or disable the autocorrect...

How to use old MSN Messenger without upgrading

  If you dont like the newer version of MSN Live Messenger and want to use the old MSN Messenger...

Software Tutorials

 

Conversion of int to byte and vice versa

(0 votes, average: 0 out of 5)





The below function is to convert an int to byte. You have to pass a int value and receive the byte in a byte array
 
 
public byte[] ToByte(int a) throws IOException
{
ByteArrayOutputStream bos=new ByteArrayOutputStream();
                DataOutputStream dos=new DataOutputStream(bos);
                dos.writeInt(a);
                dos.flush();
                byte[] b1=bos.toByteArray();
                return b1;
        }
 
 The below function is to convert an byte to int. You have to pass a byte array and receive the int value
 
One int value = 4 byte as int size is 4 byte
 
public int ToInt(byte[] b) throws IOException
{
ByteArrayInputStream bis=new ByteArrayInputStream(b);
                DataInputStream in=new DataInputStream(bis);
                int a=in.readInt();
                return a;
        }
 
 


Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Furl! Yahoo! Squidoo! Ask! DZone! Free Joomla PHP extensions, software, information and tutorials.



Comments

B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment

Tag Cloud

Login Form