diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-05-31 12:57:39 +0530 |
---|---|---|
committer | Harsh Shandilya <msfjarvis@gmail.com> | 2019-05-31 12:57:39 +0530 |
commit | daafc01ce232205096675afa20ab4982209689aa (patch) | |
tree | 11d3e0d572d0ceed7bf8ced311ff9549c6bb504a /app | |
parent | 30b6d2346a5ee856a7af49a62c274f7d979d7c2a (diff) |
Otp: Remove string concatenation from calculation hot path
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/Otp.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java b/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java index 0bacd684..2e6bebd6 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java @@ -43,13 +43,13 @@ public class Otp { code[0] = (byte) (0x7f & code[0]); String strCode = new BigInteger(code).toString(); if (digits.equals("s")) { - String output = ""; + StringBuilder output = new StringBuilder(); int bigInt = new BigInteger(code).intValue(); for (int i = 0; i != 5; i++) { - output += steam[bigInt % 26]; + output.append(steam[bigInt % 26]); bigInt /= 26; } - return output; + return output.toString(); } else return strCode.substring(strCode.length() - Integer.parseInt(digits)); } |