Article View: borland.public.jbuilder.java.language
Article #15963Re: Integer class
From: Chris Hill
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
41 lines
1783 bytes
1783 bytes
I'm not quite sure what you mean by HEX value or HEX character. I assume you want to compare an Integer to a int constant (specified as a hex literal). I would do this: if(myInt.intValue() == 0x1) // do something Is this what you wanted? Although read() returns an int, it only reads a byte. Do you really need to wrap the int in an Integer object? On Sun, 11 Apr 1999 11:08:35 -0700, "Jason C. Leach" <leachjc@hotmail.com> wrote: >Hi, > >I need a hand with the Integer class. I am using FileInputStream and >Output stream. What I do is read in a byte and store it in a Integer >object (I think): > >tmp = new Integer(fin.read()); //where tmp is passed into my method as a >Integer. > >Then it should return after some error checking..... > >Now in the calling method, once that value has been fetched I need to >check it agains a HEX value. Here is where I get confused. In C/C++ I >read the byte in as a char, this is good because a byte is a char. But >in Java I use int, and that is 4 bytes. I don't get it. And this causes >more trouble as I need to compair this just read in byte of data against >a HEX character '0x001'. > >Can anyone help with sorting out my confusion. And with the comparison >syntax? >myInteger.equals(?????); aint going to work > > jason Chris Hill Chris244@aol.com
Technical Details
Message-ID:
<3710fa40.2311545937@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3710E522.7A438C7E@hotmail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,48b0db82994ba0f7 X-Google-Attributes: gidf74b3,public From: Chris244@aol.com (Chris Hill) Subject: Re: Integer class Date: 1999/04/11 Message-ID: <3710fa40.2311545937@forums.borland.com> X-Deja-AN: 465204333 References: <3710E522.7A438C7E@hotmail.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language