Skip to content

Instantly share code, notes, and snippets.

@unserializable
unserializable / SumEvenFibo_lt_4M.java
Created June 1, 2017 07:20
Sum even Fibonacci numbers not exceeding 4 million (Project Euler Problem #2)
/*
Minimalistic (length-wise) looping Java code for Project Euler problem #2 (https://projecteuler.net/problem=2).
Finds the sum of /even/ Fibonacci numbers which do not exceed 4 million.
^= operater use for variable swap in Java cannot be as compact as in C, see:
http://stackoverflow.com/questions/3844934/why-is-this-statement-not-working-in-java-x-y-x-y
@author Taimo Peelo
*/
public class SumEvenFibo_lt_4M {
public static void main(String[] args) { // Output is 4613732
@unserializable
unserializable / NextFriday13th.java
Created January 13, 2017 15:54
Temporal play, with Friday the 13th example.
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalQuery;
import static java.time.DayOfWeek.FRIDAY;
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
@unserializable
unserializable / JdkTlsCipherSuiteList.java
Last active January 9, 2017 22:33
Lists the enabled / available ciphersuites from the running JDK
import javax.net.ssl.SSLSocketFactory;
import java.util.Set;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toSet;
/**
* @author Taimo Peelo
*/
public class JdkTlsCipherSuiteList {