Hi there. Relatively new to Java. I have an assignment which is split into parts, based on a username/password idea. First part was to create a data structure appropriate for my project and I could add items to it. Done this using a Binary Search Tree. There appears to be no error in the code, but I can't figure out how to create a main method to make sure it works properly.
Java Code:
public class BTree {

		String username;
		String password;
		BTree left;
		BTree right;

		public BTree (String u, String p, BTree l, BTree r) {
			username = u;
			password = p;
			left = l; 
			right = r;


		public BTree (String u, String p) {

			username = u;
			password = p; 
			left = null; 
			right = null;


public BTree addToBTree(String u, String p, BTree t) {

	if (t == null) return (new BTree(u, p));
        if (before (u, t.username)) return (new BTree(t.username, t.password, addToBTree(u, p, t.left), t.right));
        else return (new BTree(t.username, t.password, t.left, addToBTree(u, p, t.right)));

public static boolean before (String s1, String s2){
	if (s1.length() == 0) return true;
        if (s2.length() == 0) return false;
        if (s1.charAt(0) < s2.charAt(0)) return true;
        if (s1.charAt(0) == s2.charAt(0)) return (before(s1.substring(1),s2.substring(1)));
        return false;

public static void printBST(BTree t){
    if (t == null) return;
    else {printBST(t.left);


Any help with a main method would be greatly appreciated, grateful for any other suggestions or improvements. Thanks