Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java newbie help (type casting, 64bit unsigned Long)

Reply
Thread Tools

Java newbie help (type casting, 64bit unsigned Long)

 
 
hochidsp@gmail.com
Guest
Posts: n/a
 
      03-23-2005
Hi I am java newbie and need help on my project. I have a few
questions. Can you put strings in a hashtable and test for their being
their with the appropriate hashtable method? I want to test for equal
strings, not the same object. Second question can you use all 64 bits
of an unsigned long? java doesn't seem to allow this. Any packages that
do?
Thanks,
Dave

 
Reply With Quote
 
 
 
 
Andrew McDonagh
Guest
Posts: n/a
 
      03-23-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi I am java newbie and need help on my project. I have a few
> questions. Can you put strings in a hashtable and test for their being
> their with the appropriate hashtable method? I want to test for equal
> strings, not the same object. Second question can you use all 64 bits
> of an unsigned long? java doesn't seem to allow this. Any packages that
> do?
> Thanks,
> Dave
>


Any object can be used as either the Key or Value. The String object's
equals() method will be used to determine whether the search key is
found within the key set. Google Java String to see what the equals()
method does.

Java does not support unsigned longs or ints - they are all signed.

http://java.sun.com/docs/books/tutor...datatypes.html

If you need a bigger number than a (signed) long, then one way is to use
an array of bytes.
 
Reply With Quote
 
 
 
 
Lee Fesperman
Guest
Posts: n/a
 
      03-24-2005
Andrew McDonagh wrote:
>
> (E-Mail Removed) wrote:
> > Hi I am java newbie and need help on my project. I have a few
> > questions. Can you put strings in a hashtable and test for their being
> > their with the appropriate hashtable method? I want to test for equal
> > strings, not the same object. Second question can you use all 64 bits
> > of an unsigned long? java doesn't seem to allow this. Any packages that
> > do?

>
> Any object can be used as either the Key or Value. The String object's
> equals() method will be used to determine whether the search key is
> found within the key set. Google Java String to see what the equals()
> method does.
>
> Java does not support unsigned longs or ints - they are all signed.
>
> http://java.sun.com/docs/books/tutor...datatypes.html
>
> If you need a bigger number than a (signed) long, then one way is to use
> an array of bytes.


Try java.math.BigInteger. It's signed but you can values greater than 32-bits.

--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
================================================== ============
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      03-24-2005
<(E-Mail Removed)> wrote:
> Second question can you use all 64 bits
> of an unsigned long? java doesn't seem to allow this.


Here's a slight modification to the answers you've already received.
Java has a 64-bit integer data type. Various operators and API
functions may treat it as either signed or unsigned, or they may work
with either. Something about your phrasing suggests that you want to
use the long as a bit mask... in that case, all operators are
independent of sign, except that >>> should be used instead of >>.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(int) -> (unsigned) -> (int) or (unsigned) -> (int) -> (unsigned):I'll loose something? pozz C Programming 12 03-20-2011 11:32 PM
unsigned long to unsigned char ashtonn@gmail.com Python 1 06-01-2005 07:00 PM
comparing unsigned long and unsigned int sridhar C Programming 6 11-03-2004 03:52 AM
unsigned int const does not match const unsigned int Timo Freiberger C++ 3 10-30-2004 07:02 PM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments