+ 2
How i add 'A,B,C,D,E,F' for hexadecimal value (10,11,12,13,14,15) using my code.
14 RĂ©ponses
+ 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
+ 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
+ 6
Read the first line please: "Use a dictionary"
+ 3
You can use switch case if u want for each of the above given values....
+ 3
Ya @wen The question is different from your answer.
+ 3
I am trying my level best. Please wait for sometime.
+ 1
can you code it
+ 1
read again my question
+ 1
@vishnu can you help me.
+ 1
@vishnu thank you
+ 1
@wen i don't know what did you say.because im a beginner for this.
+ 1
help me.
+ 1
@vishnu can you
0
eny one tell me how can i add the switch case for this case