Caller statement: OAuthService PrivateKey privateKey = encryptionUtilities.string2PrivateKey(strPrivateKey); long startTime = System.currentTimeMillis(); String accessToken = jwtHelper.generateToken(payload, privateKey, tokenExpirationInMilliSeconds); LOGGER.info("Time spend in getOauthToken jwtHelper.generateToken {}", System.currentTimeMillis() - startTime); EncryptionUtil.java public PrivateKey string2PrivateKey(String privateKeyString) { long startTime = System.currentTimeMillis(); try { KeyFactory kf = KeyFactory.getInstance(ServiceConstants.RSA); PKCS8EncodedKeySpec keySpecPKCS8 = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKeyString)); PrivateKey privateKey = kf.generatePrivate(keySpecPKCS8); LOGGER.info("Time spend in string2PrivateKey {}", System.currentTimeMillis() - startTime); return privateKey; } catch (IllegalArgumentException | InvalidKeySpecException | NoSuchAlgorithmException e) { LOGGER.error(e.getMessage(), e); return null; } }