Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public Digits( int num ) {
digitList = new ArrayList<>();
int n = num;
do {
digitList.add(0, n % 10);
n /= 10;
} while (n > 0);
}
public Digits( int num ) {
digitList = new ArrayList<>();
if ( num == 0 ) {
digitList.add( 0 );
} else {
int n = num;
while ( n > 0 ) {
digitList.add( 0, n % 10 );
n /= 10;
}
}
}
public boolean isStrictlyIncreasing() {
for ( int i = 0; i < digitList.size() - 1; i++ ) {
if ( digitList.get( i ) >= digitList.get( i + 1 ) ) {
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.