+ 11

How to convert a decimal number into octal, hexadecimal, binary and also others in java?

17th Jan 2017, 11:15 PM
Ajay Agrawal
Ajay Agrawal - avatar
23 odpowiedzi
+ 11
I've made Dec-Bin but in C++. So you can do it too :P No problem, whenever you need smth
17th Jan 2017, 11:30 PM
Filip
Filip - avatar
+ 11
Than, do it in Java as well
17th Jan 2017, 11:33 PM
Filip
Filip - avatar
+ 10
Integer.toString(x, 2) - decimal to binary Integer.toString(x, 8) - decimal to octal Integer.toString(x, 16) - decimal to Hex
17th Jan 2017, 11:21 PM
Filip
Filip - avatar
+ 9
Like what?
17th Jan 2017, 11:23 PM
Filip
Filip - avatar
+ 9
Well... I think there are no built-in functions for those... You can always write a function on your own :P
17th Jan 2017, 11:26 PM
Filip
Filip - avatar
+ 8
C++?
17th Jan 2017, 11:17 PM
Filip
Filip - avatar
+ 8
I think that there's a function, which automaticly converts the numbers, but maybe I'm wrong
17th Jan 2017, 11:19 PM
Filip
Filip - avatar
+ 7
thank you so much Ms. Bindra. One more thing, how to take a string in this program as input instead of fixing 13 as input?
19th Jan 2017, 4:29 AM
Ajay Agrawal
Ajay Agrawal - avatar
+ 7
these answers are perfect for me. because I wanna to learn basic Java only. I like C or C++ more.
19th Jan 2017, 4:46 AM
Ajay Agrawal
Ajay Agrawal - avatar
+ 5
sorry for that nonsense question, but I don't like Java. but it is in our syllabus. that's the reason why I'm leaning it.
19th Jan 2017, 4:35 AM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
I think you are right because most of the things are predefined in Java
17th Jan 2017, 11:20 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
I got it
17th Jan 2017, 11:22 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
is their other functions for other conversions?
17th Jan 2017, 11:23 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
I can it make it again well thanks bro. For helping me.
17th Jan 2017, 11:29 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
I have also made it in C language in many ways.
17th Jan 2017, 11:32 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 4
brother, is their any function in Java to concert string to decimal or other base numbers?
18th Jan 2017, 6:41 AM
Ajay Agrawal
Ajay Agrawal - avatar
+ 3
in java
17th Jan 2017, 11:18 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 3
O2D, O2H, O2B ...
17th Jan 2017, 11:24 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 3
I think, Java needs to be redesigned? what you think friends?
17th Jan 2017, 11:38 PM
Ajay Agrawal
Ajay Agrawal - avatar
+ 3
why you are leaning Java?
19th Jan 2017, 4:49 AM
Ajay Agrawal
Ajay Agrawal - avatar