Skip to content

Commit 469ea9f

Browse files
committed
style fixes
1 parent 2a79399 commit 469ea9f

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

src/main/java/com/upokecenter/util/RadixMath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,8 +3767,7 @@ private T RoundToPrecisionInternal(
37673767
if (!unlimitedPrec && (rounding == Rounding.Down || rounding ==
37683768
Rounding.ZeroFiveUp ||
37693769
(rounding == Rounding.OddOrZeroFiveUp || rounding == Rounding.Odd) ||
3770-
3771-
(rounding == Rounding.Ceiling &&
3770+
(rounding == Rounding.Ceiling &&
37723771
neg) || (rounding == Rounding.Floor && !neg))) {
37733772
// Set to the highest possible value for
37743773
// the given precision

src/test/java/com/upokecenter/test/ExtendedFloatTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.upokecenter.util.*;
66

77
public class ExtendedFloatTest {
8-
public ExtendedFloat FromBinary(String str) {
8+
public static ExtendedFloat FromBinary(String str) {
99
int smallExponent = 0;
1010
int index = 0;
1111
BigInteger ret = BigInteger.ZERO;
@@ -20,15 +20,16 @@ public ExtendedFloat FromBinary(String str) {
2020
if (str.charAt(index) == '.') {
2121
++index;
2222
break;
23-
} else if (str.charAt(index)=='1') {
23+
}
24+
if (str.charAt(index) == '1') {
2425
++index;
2526
if (ret.signum() == 0) {
2627
ret = BigInteger.ONE;
2728
} else {
2829
ret = ret.shiftLeft(1);
2930
ret = ret.add(BigInteger.ONE);
3031
}
31-
} else if (str.charAt(index)=='0') {
32+
} else if (str.charAt(index) == '0') {
3233
++index;
3334
ret = ret.shiftLeft(1);
3435
continue;

src/test/java/com/upokecenter/test/RandomObjects.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ public static CBORObject RandomCBORTextString(FastRandom rand) {
101101

102102
public static CBORObject RandomCBORMap(FastRandom rand, int depth) {
103103
int x = rand.NextValue(100);
104-
int count = 0;
105-
count = (x < 80) ? 2 : ((x < 93) ? 1 : ((x < 98) ? 0 : 10));
104+
int count = (x < 80) ? 2 : ((x < 93) ? 1 : ((x < 98) ? 0 : 10));
106105
CBORObject cborRet = CBORObject.NewMap();
107106
for (int i = 0; i < count; ++i) {
108107
CBORObject key = RandomCBORObject(rand, depth + 1);
@@ -162,8 +161,7 @@ public static CBORObject RandomCBORTaggedObject(
162161

163162
public static CBORObject RandomCBORArray(FastRandom rand, int depth) {
164163
int x = rand.NextValue(100);
165-
int count = 0;
166-
count = (x < 80) ? 2 : ((x < 93) ? 1 : ((x < 98) ? 0 : 10));
164+
int count = (x < 80) ? 2 : ((x < 93) ? 1 : ((x < 98) ? 0 : 10));
167165
CBORObject cborRet = CBORObject.NewArray();
168166
for (int i = 0; i < count; ++i) {
169167
cborRet.Add(RandomCBORObject(rand, depth + 1));
@@ -276,17 +274,18 @@ public static BigInteger RandomBigInteger(FastRandom r) {
276274
if (selection < 40) {
277275
StringAndBigInt sabi = StringAndBigInt.Generate(r, 16);
278276
return sabi.getBigIntValue();
279-
} else if (selection < 50) {
277+
}
278+
if (selection < 50) {
280279
StringAndBigInt sabi = StringAndBigInt.Generate(r, 2 + r.NextValue(35));
281280
return sabi.getBigIntValue();
282281
} else {
283-
int count = r.NextValue(60) + 1;
284-
byte[] bytes = new byte[count];
285-
for (int i = 0; i < count; ++i) {
286-
bytes[i] = (byte)((int)r.NextValue(256));
282+
int count = r.NextValue(60) + 1;
283+
byte[] bytes = new byte[count];
284+
for (int i = 0; i < count; ++i) {
285+
bytes[i] = (byte)((int)r.NextValue(256));
286+
}
287+
return BigInteger.fromByteArray(bytes, true);
287288
}
288-
return BigInteger.fromByteArray(bytes, true);
289-
}
290289
}
291290

292291
public static ExtendedFloat RandomExtendedFloat(FastRandom r) {

src/test/java/com/upokecenter/test/StringAndBigInt.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.upokecenter.test;
22

3-
import org.junit.Assert;
4-
53
import com.upokecenter.util.*;
64

75
final class StringAndBigInt {

0 commit comments

Comments
 (0)