Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd hexadecimal to binary and hexadecimal to decimal conversions #1328
Conversation
I am sorry the first commit is hexadecimal to decimal conversion and the second one is hexadecimal to binary conversion ( the second commit message is false) |
40c192c
to
724ff7e
package com.conversions; | ||
|
||
public class HexadecimalToBinary { | ||
/** |
deadshotsb
May 25, 2020
Member
Your code fails in case of floating point conversion, 'ABC.BC' try doing it for real values also
@deadshotsb Okay, thank you for your feedback I will fix it now. |
@deadshotsb I have just fixed the requested changes can you check it and give me your feedback? |
package com.conversions; | ||
|
||
public class HexadecimalToBinary { | ||
/** |
* @return decimal number | ||
*/ | ||
public String hexToDecimal(String hexaStr) { | ||
String hexaNumbers = "0123456789ABCDEF"; |
nippur101
May 26, 2020
because from the point you must multiply for 1/16, the potency start to be negative
@deadshotsb you are right sir, I'll do it now! Sorry |
@MohamedBechir We are all developers no sir and boss please |
@deadshotsb can you explain more what I am supposed to do? A.B => 10.11 or A.B => 10.6875? thank you |
A.B = 16^(0)*(10) + 16^(-1) * (11) |
@deadshotsb I just fixed it, take a look. Thank you again |
I have noticed that some conversions are missing, so I started by adding the hexadecimal to decimal and the hexadecimal to binary ones, if you approve it I can work on the other ones.
My code converts a hexadecimal number to a decimal one.
NB: I am new to the software engineering community. I did my best and if anything is wrong with my code I can change it anytime, I am eager to learn more.