Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants moved to top and comment added for them #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/com/jwetherell/algorithms/numbers/Integers.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ public class Integers {
private static final BigDecimal ZERO = new BigDecimal(0);
private static final BigDecimal TWO = new BigDecimal(2);

// Constants for numerical values
private static final int BILLION = 1000000000;
private static final int MILLION = 1000000;
private static final int THOUSAND = 1000;
private static final int HUNDRED = 100;
private static final int TEN = 10;

public static final String toBinaryUsingDivideAndModulus(int numberToConvert) {
int integer = numberToConvert;
if (integer<0) throw new IllegalArgumentException("Method argument cannot be negative. number="+integer);
Expand Down Expand Up @@ -136,13 +143,7 @@ public static final boolean powerOfTwoUsingBits(int numberToCheck) {
multiDigits.put(80,"eighty");
multiDigits.put(90,"ninety");
}

private static final int BILLION = 1000000000;
private static final int MILLION = 1000000;
private static final int THOUSAND = 1000;
private static final int HUNDRED = 100;
private static final int TEN = 10;


private static final String handleUnderOneThousand(int number) {
StringBuilder builder = new StringBuilder();
int x = number;
Expand Down