style: enable NeedBraces in checkstyle (#5227)

* enable style NeedBraces

* style: enable NeedBraces in checkstyle

---------

Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:
Samuel Facchinello
2024-06-13 21:00:16 +02:00
committed by GitHub
parent 51fcc66345
commit 87b17e0571
68 changed files with 629 additions and 261 deletions

View File

@ -21,7 +21,9 @@ public final class CRC16 {
boolean bit = ((b >> (7 - i) & 1) == 1);
boolean c15 = ((crc >> 15 & 1) == 1);
crc <<= 1;
if (c15 ^ bit) crc ^= polynomial;
if (c15 ^ bit) {
crc ^= polynomial;
}
}
}
crc &= 0xffff;

View File

@ -24,7 +24,9 @@ public final class MaximumSumOfDistinctSubarraysWithLengthK {
* @return the maximum sum of distinct subarray of size K.
*/
public static long maximumSubarraySum(int k, int... nums) {
if (nums.length < k) return 0;
if (nums.length < k) {
return 0;
}
long max = 0; // this will store the max sum which will be our result
long s = 0; // this will store the sum of every k elements which can be used to compare with
// max