Created
November 27, 2018 20:54
-
-
Save CompSciRocks/17930b2000a5b45b56a885986980c05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Digits( int num ) { | |
digitList = new ArrayList<>(); | |
int n = num; | |
do { | |
digitList.add(0, n % 10); | |
n /= 10; | |
} while (n > 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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