Skip to content

Instantly share code, notes, and snippets.

@CompSciRocks
Created November 27, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CompSciRocks/17930b2000a5b45b56a885986980c05e to your computer and use it in GitHub Desktop.
Save CompSciRocks/17930b2000a5b45b56a885986980c05e to your computer and use it in GitHub Desktop.
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