How to generate OTP Number with 6 digits

后端 未结 9 1973
小蘑菇
小蘑菇 2020-12-30 17:24

What is an OTP number in a login authentication system? Is there any specific algorithm for generating OTP numbers using java (android). Or is an OTP something like random n

9条回答
  •  庸人自扰
    2020-12-30 18:03

    import java.util.*;
    
    public class OTP2 {
      static char[] OTP(int len) {
        System.out.println("Generating OTP using random ()");
        System.out.print("Your OTP is:");
    
        // Using numeric values
        String numbers = "0123456789";
    
        // Using random method 
        Random rndm_method = new Random();
        char[] otp = new char[len];
        for(int i=0; i

提交回复
热议问题