I have an arrangement with 12 elements, each one is a month of the year and they are assigned a number of days respectively
int Enero=31;
int Febrero=28;
int diciembre=31;
int cantidades[]= {Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre};
I also have a couple of attributes called Dia and Mes with which I have to count down to know how many days are left until the first of January of the following year. say enter two numbers for example 1 (Month) 2 (Day). So far I have the following but it does not work because the index goes beyond the limit but I do not know how to solve it in a way that works (ArrayIndexOutOfBoundsException: -1 at Dates.Regular account)
I need to count the days of each month along with the days of the current month
public int cuentaRegresiva(){
int diasTotales;
int diasTranscurridos=0;
int diasFaltantes;
int iterador=Mes;
int contador=2;
while (contador<13){
diasTranscurridos+=cantidades[iterador-contador];
contador+=1 }
diasTranscurridos=diasTranscurridos+Dia;'
}