File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/main/java/com/thealgorithms/bitmanipulation Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 2525public final class BitwiseGCD {
2626
2727 private BitwiseGCD () {
28-
2928 }
3029
3130 /**
@@ -106,15 +105,16 @@ private static long absOrThrowIfOverflow(long x) {
106105 * will be thrown.
107106 */
108107 public static long gcd (long ... values ) {
109- if (values == null || values .length == 0 ) {
108+
109+ if (values == null || values .length == 0 ) {
110110 return 0L ;
111111 }
112112 long result = values [0 ];
113113 for (int i = 1 ; i < values .length ; i ++) {
114114 result = gcd (result , values [i ]);
115- if (result == 1L ) {
115+ if (result == 1L ) {
116116 return 1L ; // early exit
117- }
117+ }
118118 }
119119 return result ;
120120 }
@@ -128,7 +128,8 @@ public static long gcd(long... values) {
128128 * @return non-negative gcd as a {@link BigInteger}
129129 */
130130 public static BigInteger gcdBig (BigInteger a , BigInteger b ) {
131- if (a == null || b == null ) {
131+
132+ if (a == null || b == null ) {
132133 throw new NullPointerException ("Arguments must not be null" );
133134 }
134135 return a .abs ().gcd (b .abs ());
You can’t perform that action at this time.
0 commit comments