Hi I'm new to Java. I'm writing a method to calculate years it takes to pay off a debt when user enters debt, interest, and payment. I can't seem to get it to output a different result when the user's payment isn't enough to cover the debt. Any help is appreciated. Please see code below:

int debtCalculator(double debt, double interest, double payment) {
//calculate years to pay off debt
int years=0;
double newDebt;
do {
double interestAdded = debt * (interest/100);
debt = interestAdded + debt;
debt = debt - payment;
while ((debt >= 0) && (newDebt>debt));

// check to see if debt is decreasing

System.out.println("Your debt will never be paid off");
return -1;

return years;