Skip to content

Instantly share code, notes, and snippets.

@adamtowerz
adamtowerz / xo.java
Created May 4, 2018 22:15
UW CSE 142 Au2010 Midterm: Problem XO
public static void xo(int a) {
for (int i = 0; i < a; i++) { // rows
for (int j = 0; j < a; j++) { // columns
if (j == i || j == a - 1 - i) {
System.out.print("x");
} else {
System.out.print("o");
}
}
System.out.println();
public static <t> String fencePost(t[] a, String post){
StringBuilder sb = new StringBuilder();
for (t comp : a) {
if (sb.length() != 0) sb.append(post);
sb.append(comp);
}
return sb.toString();
}
@adamtowerz
adamtowerz / Class Finder
Created November 8, 2013 08:22
A java method used to locate and return all classes in a folder that extend a certain class (input), it takes a package string as input also (e.g. "example.example2"
package me.project.fileSearch;
import java.io.File;
import java.io.FilenameFilter;
import java.net.URL;
import java.util.List;
public class ClassFinder{