mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 05:22:39 +08:00
style: enable MultipleVariableDeclarations
in checkstyle (#5175)
Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
This commit is contained in:
@ -27,7 +27,8 @@ public final class AnyBaseToAnyBase {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
String n;
|
||||
int b1, b2;
|
||||
int b1;
|
||||
int b2;
|
||||
while (true) {
|
||||
try {
|
||||
System.out.print("Enter number: ");
|
||||
@ -132,7 +133,8 @@ public final class AnyBaseToAnyBase {
|
||||
// Declare variables: decimal value of n,
|
||||
// character of base b1, character of base b2,
|
||||
// and the string that will be returned.
|
||||
int decimalValue = 0, charB2;
|
||||
int decimalValue = 0;
|
||||
int charB2;
|
||||
char charB1;
|
||||
String output = "";
|
||||
// Go through every character of n
|
||||
|
@ -15,7 +15,9 @@ public final class AnytoAny {
|
||||
int sn = scn.nextInt();
|
||||
int sb = scn.nextInt();
|
||||
int db = scn.nextInt();
|
||||
int m = 1, dec = 0, dn = 0;
|
||||
int m = 1;
|
||||
int dec = 0;
|
||||
int dn = 0;
|
||||
while (sn != 0) {
|
||||
dec = dec + (sn % 10) * m;
|
||||
m *= sb;
|
||||
|
@ -10,7 +10,10 @@ final class BinaryToDecimal {
|
||||
}
|
||||
|
||||
public static long binaryToDecimal(long binNum) {
|
||||
long binCopy, d, s = 0, power = 0;
|
||||
long binCopy;
|
||||
long d;
|
||||
long s = 0;
|
||||
long power = 0;
|
||||
binCopy = binNum;
|
||||
while (binCopy != 0) {
|
||||
d = binCopy % 10;
|
||||
|
@ -32,7 +32,8 @@ public final class BinaryToOctal {
|
||||
*/
|
||||
public static String convertBinaryToOctal(int binary) {
|
||||
String octal = "";
|
||||
int currBit = 0, j = 1;
|
||||
int currBit = 0;
|
||||
int j = 1;
|
||||
while (binary != 0) {
|
||||
int code3 = 0;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
@ -24,7 +24,10 @@ final class DecimalToBinary {
|
||||
* conventional algorithm.
|
||||
*/
|
||||
public static void conventionalConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
int n;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Conventional conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
@ -42,7 +45,10 @@ final class DecimalToBinary {
|
||||
* algorithm
|
||||
*/
|
||||
public static void bitwiseConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
int n;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Bitwise conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
|
@ -18,7 +18,11 @@ public final class DecimalToOctal {
|
||||
// enter in a decimal value to get Octal output
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int n, k, d, s = 0, c = 0;
|
||||
int n;
|
||||
int k;
|
||||
int d;
|
||||
int s = 0;
|
||||
int c = 0;
|
||||
System.out.print("Decimal number: ");
|
||||
n = sc.nextInt();
|
||||
k = n;
|
||||
|
@ -56,7 +56,8 @@ public final class HexToOct {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String hexadecnum;
|
||||
int decnum, octalnum;
|
||||
int decnum;
|
||||
int octalnum;
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
System.out.print("Enter Hexadecimal Number : ");
|
||||
|
Reference in New Issue
Block a user