Need java help!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Need java help!!!

is there any built in function/method to convert binary, octal and hex to decimal in Java.

14th Mar 2017, 3:47 PM
Ajay Agrawal
Ajay Agrawal - avatar
26 Answers
+ 13
I don't understand Brad's posts. They seem to belong to another question. But Dayve is right if your values are binary, oct and hex values. If you just save the values to a String, use Integer.valueOf to convert to decimal. You don't need an import, because class Integer is part of the lang package, that is always accessible.
14th Mar 2017, 4:58 PM
Tashi N
Tashi N - avatar
+ 10
using Integer.parseInt() method. Found on Google:)
14th Mar 2017, 4:07 PM
Dev
Dev - avatar
+ 10
@Brad Ok, you've had your fun. If you're referring to code at the playground, just leave a comment there.
14th Mar 2017, 5:04 PM
Tashi N
Tashi N - avatar
+ 10
OK, Brad. Then I apologise. *silentmode:on*
14th Mar 2017, 5:15 PM
Tashi N
Tashi N - avatar
+ 8
@Ajay yes import java.util.*; package
15th Mar 2017, 4:13 AM
Dev
Dev - avatar
+ 7
I'll trying it now. thanks @Dayve
14th Mar 2017, 4:09 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 7
@Brad Rogers, sorry I'm not understand it? Please explain me. ajay can you add in the pictures and video to the blue box in the curve i posted?
14th Mar 2017, 4:19 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 7
Hey @Dayve, is this method requires any package to be imported?
14th Mar 2017, 4:20 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 6
yes,i can made it easily. but wanna to know, in Java for this purpose built-in function is available or not?
14th Mar 2017, 4:08 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 6
SORRY @Brad Rogers, I know you are tying to help, but I'm unable to understand, what you are saying?
14th Mar 2017, 4:25 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 1
can you fix the code? i pulled from your sets
14th Mar 2017, 4:00 PM
Brad Rogers
Brad Rogers - avatar
+ 1
you could code a conversion method to compute the changes you require
14th Mar 2017, 4:02 PM
Brad Rogers
Brad Rogers - avatar
+ 1
i only have one code displayed
14th Mar 2017, 5:12 PM
Brad Rogers
Brad Rogers - avatar
0
0000=0/ 0001=1 /0010=2 /0100=3 /0101=4 and when you type the octal just convert the numbers
14th Mar 2017, 4:10 PM
Brad Rogers
Brad Rogers - avatar
0
ajay can you add in the pictures and video to the blue box in the curve i posted?
14th Mar 2017, 4:16 PM
Brad Rogers
Brad Rogers - avatar
0
its a header display for a game set you could use in your game
14th Mar 2017, 4:18 PM
Brad Rogers
Brad Rogers - avatar
0
your users could simply click the header to pop to main screen for display
14th Mar 2017, 4:20 PM
Brad Rogers
Brad Rogers - avatar
0
main screen under header
14th Mar 2017, 4:20 PM
Brad Rogers
Brad Rogers - avatar
0
main screen will be where all operations are handled
14th Mar 2017, 4:21 PM
Brad Rogers
Brad Rogers - avatar
0
game,text,video viewing,galleries
14th Mar 2017, 4:22 PM
Brad Rogers
Brad Rogers - avatar