This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Helper { | |
| public static BitSet generatePrimes(final int maxNum) { | |
| final BitSet set = new BitSet(maxNum+1); | |
| set.clear(0, 1); | |
| set.set(2, maxNum, true); | |
| for (int i = 2; i < maxNum; i++) { | |
| boolean isPrime = true; | |
| for (int j = 0; j < (int) Math.sqrt(i); j++) { | |
| if (!set.get(j)) { | |
| continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package monster; | |
| import java.io.File; | |
| import java.io.IOException; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import org.codehaus.jackson.map.ObjectMapper; | |
| import org.codehaus.jackson.map.SerializationConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "kind": "Listing", | |
| "data": { | |
| "modhash": "ktve0h61g983ea8a06d93d647897c6b1091b00331882f45a35", | |
| "children": [ | |
| { | |
| "kind": "t3", | |
| "data": { | |
| "domain": "i.imgur.com", | |
| "banned_by": null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| import java.net.URL; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| import java.util.stream.Collectors; | |
| import static java.lang.Integer.compare; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package misc; | |
| import org.openjdk.jmh.annotations.*; | |
| import org.openjdk.jmh.runner.Runner; | |
| import org.openjdk.jmh.runner.RunnerException; | |
| import org.openjdk.jmh.runner.options.Options; | |
| import org.openjdk.jmh.runner.options.OptionsBuilder; | |
| import java.util.Arrays; | |
| import java.util.HashSet; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package droptable; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.List; | |
| import java.util.Locale; | |
| public class DropTable { | |
| private List<DropChance> table; | |
| private boolean sorted; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sierpinski; | |
| import javax.swing.JFrame; | |
| import javax.swing.JPanel; | |
| import javax.swing.WindowConstants; | |
| import java.awt.Dimension; | |
| import java.awt.Graphics; | |
| import java.awt.Graphics2D; | |
| import java.awt.Point; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package thread; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.Random; | |
| import java.util.concurrent.ArrayBlockingQueue; | |
| import java.util.concurrent.BlockingQueue; | |
| /** | |
| * Example that shows communications between threads through blocking queues. There are 4 worker threads and one printer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.BitSet; | |
| public class EratosthenesSieve { | |
| private BitSet primes = null; | |
| public void init(int maxNum) { | |
| final long start = System.currentTimeMillis(); | |
| primes = new BitSet(maxNum+1); | |
| primes.clear(0, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package crypt; | |
| import javax.xml.bind.DatatypeConverter; | |
| import java.util.*; | |
| public class SubstCrypto { | |
| private static char[] createKey(long seed) { | |
| char[] key = new char[256]; | |
| for(int i = 0;i < key.length;i++) { |
OlderNewer