Skip to content

Commit c31c39a

Browse files
committed
Removed usage of BigInteger constructor for constants
1 parent a7a9abd commit c31c39a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/java/com/conversions/BinaryToHexadecimal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public String binToHex(String binStr) {
3636
String hex = "";
3737

3838
int currentBit;
39-
BigInteger tenValue = new BigInteger("10");
39+
BigInteger tenValue = BigInteger.valueOf(10);
4040
while (binary.compareTo(BigInteger.ZERO) != 0) {
4141
// to store decimal equivalent of number formed by 4 decimal digits
4242
int code4 = 0;

src/main/java/com/conversions/DecimalToHexadecimal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class DecimalToHexadecimal {
66
private static final char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
7-
private static final BigInteger valueHex = new BigInteger("16");
7+
private static final BigInteger valueHex = BigInteger.valueOf(16);
88

99
/**
1010
* This method converts and decimal number to a Hexadecimal number

src/main/java/com/conversions/DecimalToOctal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class DecimalToOctal {
66
private static final char[] octalChars = {'0', '1', '2', '3', '4', '5', '6', '7'};
7-
private static final BigInteger valueOctal = new BigInteger("8");
7+
private static final BigInteger valueOctal = BigInteger.valueOf(8);
88

99
/**
1010
* This method converts and decimal number to a octal number

0 commit comments

Comments
 (0)