We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
DOCS
1 parent 2871c44 commit 5e190a7Copy full SHA for 5e190a7
src/PracticeAlgorithms.java
@@ -3,19 +3,28 @@ public static boolean isBetweenZeroAndOne(double x, double y) {
3
return (0 < x && x < 1) && (0 < y && y < 1);
4
}
5
6
+ /**
7
+ * static method to return the binary string representation of an integer
8
+ * */
9
public static String toBinaryString(int x) {
10
StringBuilder binaryString = new StringBuilder();
11
binaryString.append(binaryFormString(x, binaryString.toString()));
12
13
return binaryString.toString();
14
15
16
17
+ * static recursive method that "builds" the binary string
18
19
private static String binaryFormString(int x, String binString) {
20
if (x == 1) return binString + "1";
21
22
return binaryFormString(x / 2, binString) + (x % 2);
23
24
25
26
+ * static method to print a "*" or " " depending on the contents in a two-dimensional array
27
28
public static void printTwoDmBooleanArray(boolean[][] theArray) {
29
for (boolean[] row : theArray) {
30
for (boolean column : row) {
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments