General performance improvement (#6078)

This commit is contained in:
Strange Developer
2024-11-01 18:52:42 +01:00
committed by GitHub
parent 7b962a4a1d
commit df0c997e4b
29 changed files with 92 additions and 75 deletions

View File

@@ -52,9 +52,11 @@ public class HexaDecimalToBinary {
*/
public String completeDigits(String binNum) {
final int byteSize = 8;
while (binNum.length() < byteSize) {
binNum = "0" + binNum;
StringBuilder binNumBuilder = new StringBuilder(binNum);
while (binNumBuilder.length() < byteSize) {
binNumBuilder.insert(0, "0");
}
binNum = binNumBuilder.toString();
return binNum;
}
}