Code example for Stopwatch

0
		return new org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder(rounds);
	} 
 
	@Override 
	public String encode(CharSequence rawPassword) {
		Stopwatch stopwatch = new Stopwatch().start();
		String encPass = encoder.encode(rawPassword);
		if (log.isTraceEnabled()) { 
			log.trace("time taken to encode password: {} ms", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); //$NON-NLS-1$
		} 
		return encPass;
	} 
 
	@Override 
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		Stopwatch stopwatch = new Stopwatch().start();
		boolean valid = encoder.matches(rawPassword, encodedPassword);
		if (log.isTraceEnabled()) { 
			log.trace("time taken to verify password: {} ms", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); //$NON-NLS-1$
		} 
Experience pair programming with AI  Get Codota for Java