import java.util.Vector;

public class Node {
	private int balance;
	private String name;
	private Vector<Debt> debts;
	private boolean isHead;

	public Node(String name, int balance) {
		this.name = name;
		this.balance = balance;
		isHead = true;
		debts = new Vector<Debt>();
	}

	public String getName() {
		return name;
	}
	
	public int getBalance() {
		return balance;
	}

	public void setHead(boolean isHead) {
		this.isHead = isHead;
	}

	public void addDebt(Debt debt) {
		debts.add(debt);
	}

	public boolean isHead() {
		return isHead;
	}

	public String toDot() {
		String str = "";
		Debt debt;
		for(int i=0; i < debts.size(); i++){
			debt = debts.get(i);
			str += "\"" + name + "\n" + balance + "\" -> \"" + debt.getTo().getName() + "\n" + debt.getTo().getBalance() + "\" [label=" + debt.getAmount() + "];\n";
		}
		return str;
	}
}
@@ -678,51 +678,78 @@
  += 
-%22%5C%22%22 + name + %22%5Cn%22 + balance + %22%5C%22 -%3E %5C%22%22 +
+String.format(%22%5C%22%25s %25d%5C%22 -%3E %5C%22%25s %25d%5C%22 %5Blabel=%5C%22%25d%5C%22%5D%25n%22,name, balance,
  deb
@@ -771,17 +771,9 @@
 me()
- + %22%5Cn%22 +
+,
  deb
@@ -798,25 +798,9 @@
 ce()
- + %22%5C%22 %5Blabel=%22 +
+,
  deb
@@ -816,17 +816,9 @@
 nt()
- + %22%5D;%5Cn%22
+)
 ;%0A%09%09

better output