Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Hex Fix

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a problem with conversion from hex and oct to decimal and vice versa. I am conversant with the values normally shown i.e 0xffff etc.
But I wanted to know is there a shortcut to convert hex values like 0xf2f0. And more importantly, will such values be asked in the exam for bitshifting examples?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the static conversion methods in Integer, Long and other wrapper classes.
parseInt( String s, int radix ) will do base 8 and 16 from String to int.
toHexString( int n )
toOctalString( int n )
toBinaryString( int n )
are handy too. You might see constants in hex format but I don't think they ever use octal in a question.
Bill
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Check out this URL
http://www.rz.uni-hohenheim.de/rz/sys/basics/csc102/ch3.html
Surya
 
Trailboss
Posts: 23227
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PROPER NAMES ARE NOW REQUIRED!
Please see http://www.javaranch.com/ubb/Forum10/HTML/000180.html for details.
 
Ajay Nair
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Surya. I got it now. That link really helped!!
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic