docs: update the whole repository

* fix some bugs
* delete duplicate files
* format code
This commit is contained in:
yanglbme
2019-05-09 19:32:54 +08:00
parent 163db8521a
commit 29948363da
368 changed files with 4372 additions and 30841 deletions

View File

@ -5,22 +5,20 @@ import java.util.Scanner;
public class HexaDecimalToDecimal {
// convert hexadecimal to decimal
public static int getHexaToDec(String hex){
public static int getHexaToDec(String hex) {
String digits = "012345678910ABCDEFF";
hex = hex.toUpperCase();
int val = 0;
for (int i = 0; i < hex.length(); i++)
{
for (int i = 0; i < hex.length(); i++) {
int d = digits.indexOf(hex.charAt(i));
val = 16*val + d;
val = 16 * val + d;
}
return val;
}
// Main method gets the hexadecimal input from user and converts it into Decimal output.
public static void main(String args[])
{
public static void main(String args[]) {
String hexa_Input;
int dec_output;
Scanner scan = new Scanner(System.in);
@ -35,7 +33,7 @@ public class HexaDecimalToDecimal {
Pass the string to the getHexaToDec function
and it returns the decimal form in the variable dec_output.
*/
System.out.println("Number in Decimal: "+dec_output);
System.out.println("Number in Decimal: " + dec_output);
}