Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e190a7

Browse files
committed
DOCS Added docs to implemented methods
1 parent 2871c44 commit 5e190a7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎src/PracticeAlgorithms.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,28 @@ public static boolean isBetweenZeroAndOne(double x, double y) {
33
return (0 < x && x < 1) && (0 < y && y < 1);
44
}
55

6+
/**
7+
* static method to return the binary string representation of an integer
8+
* */
69
public static String toBinaryString(int x) {
710
StringBuilder binaryString = new StringBuilder();
811
binaryString.append(binaryFormString(x, binaryString.toString()));
912

1013
return binaryString.toString();
1114
}
1215

16+
/**
17+
* static recursive method that "builds" the binary string
18+
* */
1319
private static String binaryFormString(int x, String binString) {
1420
if (x == 1) return binString + "1";
1521

1622
return binaryFormString(x / 2, binString) + (x % 2);
1723
}
1824

25+
/**
26+
* static method to print a "*" or " " depending on the contents in a two-dimensional array
27+
* */
1928
public static void printTwoDmBooleanArray(boolean[][] theArray) {
2029
for (boolean[] row : theArray) {
2130
for (boolean column : row) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /