Welcome to Dream.In.Code
Become a Java Expert!

Join 149,825 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,572 people online right now. Registration is fast and FREE... Join Now!




64bit rotation

 
Reply to this topicStart new topic

64bit rotation

cemplukcute2003
20 Feb, 2007 - 02:04 AM
Post #1

New D.I.C Head
*

Joined: 15 Nov, 2006
Posts: 24



Thanked: 1 times
My Contributions
Hello...
I need some help here.I'm trying to rotate a 64bit input.
I use some code like this :
CODE

    rotate = (conversion.intValue() >>> 16) | (conversion.intValue() << 48);


But it couldn't work. Just now i read that the method only works for 32bit input. Is it correct?
Can someone help me, pls?
Thanks...
User is offlineProfile CardPM
+Quote Post

Programmist
RE: 64bit Rotation
20 Feb, 2007 - 02:50 AM
Post #2

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,253



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
If you're dealing with 64-bit integral values, you'll want to use type "long" rather than int.
User is online!Profile CardPM
+Quote Post

cemplukcute2003
RE: 64bit Rotation
20 Feb, 2007 - 05:52 AM
Post #3

New D.I.C Head
*

Joined: 15 Nov, 2006
Posts: 24



Thanked: 1 times
My Contributions
QUOTE(alcdotcom @ 20 Feb, 2007 - 03:50 AM) *

If you're dealing with 64-bit integral values, you'll want to use type "long" rather than int.


Thank you for your advice. But can i use the method like the one that i posted? Or i must do something to rotate the "long" value?
User is offlineProfile CardPM
+Quote Post

Programmist
RE: 64bit Rotation
20 Feb, 2007 - 07:50 AM
Post #4

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,253



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
I don't know exactly what you mean by "rotate." You're going to have to be more clear on what you mean. But that doesn't mater because you are using the wrong data type for 64-bit integers. In Java an int uses 32 bits and a long uses 64 bits. FYI: Their object wrappers are Integer and Long.
User is online!Profile CardPM
+Quote Post

cemplukcute2003
RE: 64bit Rotation
20 Feb, 2007 - 08:37 AM
Post #5

New D.I.C Head
*

Joined: 15 Nov, 2006
Posts: 24



Thanked: 1 times
My Contributions
QUOTE(alcdotcom @ 20 Feb, 2007 - 08:50 AM) *

I don't know exactly what you mean by "rotate." You're going to have to be more clear on what you mean. But that doesn't mater because you are using the wrong data type for 64-bit integers. In Java an int uses 32 bits and a long uses 64 bits. FYI: Their object wrappers are Integer and Long.


Oh, ok2. I understand now.
Thanks for your help...smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:26AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month