+ 2

How i add 'A,B,C,D,E,F' for hexadecimal value (10,11,12,13,14,15) using my code.

https://code.sololearn.com/cCdZ1l99zx4l/?ref=app

15th May 2017, 9:25 AM
Madusha chamal
Madusha chamal - avatar
14 Answers
+ 8
Use Integer.toString(intValue , base) built in method or if you want to develop your algorithm visit this thread http://stackoverflow.com/questions/15735079/convert-from-one-base-to-another-in-java
15th May 2017, 10:13 AM
Vaibhav Sharma
Vaibhav Sharma - avatar
+ 6
You can create a dictionary for it. Or if you want the algorithm for it, you can have it here: (Works from Base10 to any other base) 1. Divide the number by the number of the base to which you are converting to. [Ex. To Base16, divide by 16] 2. Record the remainder. 3. Divide the whole number result of the previous division by the base again. 4. Log the remainder to the left of the last remainder written. 5. Repeat step 3-4 until your results become 0. Example Base10 of value 19 to Base16 1. 19/6 == 1 with remainder of 3. [Log down 3] 2. 1/16 == 0 with remainder of 1 [Record down 1 to the left of 3, you get 13] 3. Since I got 0 from my last division, I do not divide anymore. 4. Hence, value 19 in Base10 is the same as 13 in Base16
15th May 2017, 9:45 AM
Wen Qin
Wen Qin - avatar
+ 6
Read the first line please: "Use a dictionary"
15th May 2017, 9:50 AM
Wen Qin
Wen Qin - avatar
+ 3
You can use switch case if u want for each of the above given values....
15th May 2017, 9:31 AM
Vishnu ks
Vishnu ks - avatar
+ 3
Ya @wen The question is different from your answer.
15th May 2017, 9:49 AM
Vishnu ks
Vishnu ks - avatar
+ 3
I am trying my level best. Please wait for sometime.
15th May 2017, 9:50 AM
Vishnu ks
Vishnu ks - avatar
+ 1
can you code it
15th May 2017, 9:32 AM
Madusha chamal
Madusha chamal - avatar
+ 1
read again my question
15th May 2017, 9:48 AM
Madusha chamal
Madusha chamal - avatar
+ 1
@vishnu can you help me.
15th May 2017, 9:50 AM
Madusha chamal
Madusha chamal - avatar
+ 1
@vishnu thank you
15th May 2017, 9:51 AM
Madusha chamal
Madusha chamal - avatar
+ 1
@wen i don't know what did you say.because im a beginner for this.
15th May 2017, 9:52 AM
Madusha chamal
Madusha chamal - avatar
+ 1
help me.
15th May 2017, 4:19 PM
Madusha chamal
Madusha chamal - avatar
+ 1
@vishnu can you
15th May 2017, 4:39 PM
Madusha chamal
Madusha chamal - avatar
0
eny one tell me how can i add the switch case for this case
16th May 2017, 12:51 AM
Madusha chamal
Madusha chamal - avatar