Removed usage of BigInteger constructor for constants

This commit is contained in:
Abhijay Kumar 2019-05-28 17:45:32 +05:30
parent a7a9abd8c0
commit c31c39a08e
3 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ public class BinaryToHexadecimal {
String hex = ""; String hex = "";
int currentBit; int currentBit;
BigInteger tenValue = new BigInteger("10"); BigInteger tenValue = BigInteger.valueOf(10);
while (binary.compareTo(BigInteger.ZERO) != 0) { while (binary.compareTo(BigInteger.ZERO) != 0) {
// to store decimal equivalent of number formed by 4 decimal digits // to store decimal equivalent of number formed by 4 decimal digits
int code4 = 0; int code4 = 0;

View File

@ -4,7 +4,7 @@ import java.math.BigInteger;
public class DecimalToHexadecimal { public class DecimalToHexadecimal {
private static final char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; private static final char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
private static final BigInteger valueHex = new BigInteger("16"); private static final BigInteger valueHex = BigInteger.valueOf(16);
/** /**
* This method converts and decimal number to a Hexadecimal number * This method converts and decimal number to a Hexadecimal number

View File

@ -4,7 +4,7 @@ import java.math.BigInteger;
public class DecimalToOctal { public class DecimalToOctal {
private static final char[] octalChars = {'0', '1', '2', '3', '4', '5', '6', '7'}; private static final char[] octalChars = {'0', '1', '2', '3', '4', '5', '6', '7'};
private static final BigInteger valueOctal = new BigInteger("8"); private static final BigInteger valueOctal = BigInteger.valueOf(8);
/** /**
* This method converts and decimal number to a octal number * This method converts and decimal number to a octal number