mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-08-02 14:13:47 +08:00
Fixed Error:(6, 8) java: class algorithm is public, should be declared in a file named algorithm.java. Inside file PrimeFactorization, the name of public class was wrong.
This commit is contained in:
@ -27,7 +27,7 @@ class DecimalToBinary {
|
||||
public static void conventionalConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Conventional conversion.\n\tEnter the decimal number: ");
|
||||
System.out.printf("Conventional conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
while (n != 0) {
|
||||
d = n % 2;
|
||||
@ -46,7 +46,7 @@ class DecimalToBinary {
|
||||
public static void bitwiseConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Bitwise conversion.\n\tEnter the decimal number: ");
|
||||
System.out.printf("Bitwise conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
while (n != 0) {
|
||||
d = (n & 1);
|
||||
|
@ -15,7 +15,7 @@ public class OctalToHexadecimal {
|
||||
* @param s The Octal Number
|
||||
* @return The Decimal number
|
||||
*/
|
||||
public static int OctToDec(String s) {
|
||||
public static int octToDec(String s) {
|
||||
int i = 0;
|
||||
for (int j = 0; j < s.length(); j++) {
|
||||
char num = s.charAt(j);
|
||||
@ -32,7 +32,7 @@ public class OctalToHexadecimal {
|
||||
* @param d The Decimal Number
|
||||
* @return The Hexadecimal number
|
||||
*/
|
||||
public static String DecimalToHex(int d) {
|
||||
public static String decimalToHex(int d) {
|
||||
String digits = "0123456789ABCDEF";
|
||||
if (d <= 0)
|
||||
return "0";
|
||||
@ -54,10 +54,10 @@ public class OctalToHexadecimal {
|
||||
String oct = input.next();
|
||||
|
||||
// Pass the octal number to function and get converted deciaml form
|
||||
int decimal = OctToDec(oct);
|
||||
int decimal = octToDec(oct);
|
||||
|
||||
// Pass the decimla number to function and get converted Hex form of the number
|
||||
String hex = DecimalToHex(decimal);
|
||||
String hex = decimalToHex(decimal);
|
||||
System.out.println("The Hexadecimal equivalant is: " + hex);
|
||||
input.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user