This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of Refactoring for Software Design Smells: Managing Technical Debt this week in the OO, Patterns, UML and Refactoring forum!

# Octal

Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93
I wanna know how to convert octal to decimal
and decimal to octal
and I also wanna know how to convert octal to binary and binary to octal
and how to convert hex to decimal and decimal to hex and hex to binary and binary to hex,
Where should I look for it?
La Vish
Ranch Hand

Joined: Apr 17, 2002
Posts: 161
Hi Gautam,
Just use the search facility on top and type in Octal and press enter and you will find this subject discussed over and over again in this forum.
Good luck
[ May 08, 2002: Message edited by: La Vish ]

La Vish
SCJP 1.4, President 60s Club
Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93
If we wanna do some bit shifting on an octal number manually,then we'll have to first convert it into a binary no. and then perform the shifting.
if a binary no. is like this:
00000011
then >>2 would mean:
11000000
coz 1 is shifted right,and other 1 is shifted right
IF i m wrong pls correct me
Thanks
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Gautam,
when you're doing bit shifting, the bits at the end (in the case of right shifting, >> ) are not rotated, as in your example, but simply fall off. Therefore:
0000 0011 >> 2 becomes 0000 0000 (which is zero).
Whether you have an octal, a decimal, a hexadecimal or even a binary number does not matter - internally they are all represented as binary numbers.