Formatting

This commit is contained in:
Gunnar Morling 2024-01-04 19:03:42 +01:00
parent 9b0b10f101
commit c1954f6a3f

View File

@ -37,12 +37,14 @@ public class CalculateAverage_artsiomkorzun {
private static final int SEGMENT_OVERLAP = 1024; private static final int SEGMENT_OVERLAP = 1024;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
/*for (int i = 0; i < 10; i++) { /*
long start = System.currentTimeMillis(); * for (int i = 0; i < 10; i++) {
execute(); * long start = System.currentTimeMillis();
long end = System.currentTimeMillis(); * execute();
System.err.println("Time: " + (end - start)); * long end = System.currentTimeMillis();
}*/ * System.err.println("Time: " + (end - start));
* }
*/
execute(); execute();
} }
@ -103,7 +105,8 @@ public class CalculateAverage_artsiomkorzun {
private static long size(Path file) { private static long size(Path file) {
try { try {
return Files.size(file); return Files.size(file);
} catch (IOException e) { }
catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -111,7 +114,8 @@ public class CalculateAverage_artsiomkorzun {
private static MappedByteBuffer map(long position, int size) { private static MappedByteBuffer map(long position, int size) {
try (FileChannel channel = FileChannel.open(FILE, StandardOpenOption.READ)) { try (FileChannel channel = FileChannel.open(FILE, StandardOpenOption.READ)) {
return channel.map(FileChannel.MapMode.READ_ONLY, position, size); // leaking until gc return channel.map(FileChannel.MapMode.READ_ONLY, position, size); // leaking until gc
} catch (Throwable e) { }
catch (Throwable e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -138,7 +142,8 @@ public class CalculateAverage_artsiomkorzun {
b = buffer.get(); b = buffer.get();
if (b == '-') { if (b == '-') {
multiplier = -1; multiplier = -1;
} else { }
else {
assert b >= '0' && b <= '9'; assert b >= '0' && b <= '9';
value = b - '0'; value = b - '0';
} }