java - Testing string for ascending order -


I have written a piece of code here to generate a random pin number of a specific length. This code works fine, but I want to add an exception where the pin ends in ascending order. For example, if a PIN is expired, 1234, 3456, 4567 will become invalid pins.

  public static string generation (int nmrpinidit) {string pin = new string (); NUMBER_PIN_DIGITS = NmR pin dygets; For (int i = 0; i    

edit

Actually the question of OP is probably To know more about what a pin is in a sequence:

  char prev = pin.charAt (0); For (four f: pins. Substring (1) .to carrier ()) {if (chr - prev! = 1) {// No sequence return false; } Prev = chr; } // is a sequence! Back true;  

goes to the same order, just a test value as a -1 .


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -