When I run the program by console, I would like it to count the number of characters I have pressed, by the time I reach 13, I would like to press ENTER to enter the number entered.
The example of the method is this:
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader (isr);
public void escribirCodigo(){
long codigo = 0;
System.out.println("Introduce el código de barras.");
try{
codigo = Long.parseLong(br.readLine());
revisarCodigoBaseDatos(codigo);
System.out.println("El valor introducido es: "+codigo);
} catch(IOException e){
System.out.println("Ha ocurrido un error.");
}
}
The method 'checkCodeDatabase (code)' is where I check if the number entered is in the database. I want that when I check that there are 13 digits automatically in the console that take the value entered and perform the method 'checkCodeDownDates (code)'