I hereby claim:
- I am apetz on github.
- I am tonypetz (https://keybase.io/tonypetz) on keybase.
- I have a public key ASAT9HdjmAwXCv0XyafODxSsWpWS-RaN-BkBfa0uweCQ3go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/** | |
* Prints numbers from 1 to 100. For multiples of three, it prints "Fizz" instead of the number and for the multiples | |
* of five it prints "Buzz" and for prime numbers it also adds a "Bang" | |
*/ | |
public class FizzBuzz { | |
public static void main(String[] args) { | |
for (int i=1; i<=100; i++) { | |
boolean isPrime = isPrime(i); | |
if (i % 3 == 0) System.out.print("Fizz"); |
/** | |
* Prints a pyramid of stars to STDOUT, of the height provided as a command line argument. | |
* | |
* Takes only one command line argument (height, as a positive integer). | |
*/ | |
public class Pyramid { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.err.println("Must supply the desired height (as positive integer) as the first argument"); |
import java.util.UUID; | |
/** | |
* Reverses the string provided as the first command line argument using recursion | |
* | |
* Optional 2nd command line argument of '-p' or '--performanceTest' will run a quick and dirty performance test | |
* of the iterative versus the recursive solution | |
* | |
*/ | |
public class ReverseString { |
import java.util.Comparator; | |
import java.util.stream.Stream; | |
/** | |
* Program that sorts a given (as a static final class variable) list of names | |
* | |
* Takes one (optional) argument that controls whether to sort by first name or last name | |
* | |
* usage: | |
* java Names {-s --surname} |
import java.util.regex.Pattern; | |
/** | |
* A (very) simple program that takes one optional command-line argument <name> | |
* and prints "Hello, <name>!" to STDOUT | |
* | |
* If no command line argument is provided, the program prints "Hello, world!" instead | |
* | |
* Can be compiled run using the following: | |
* $ javac HelloWorld.java |