public static void main(String[] args) {
        final Account a = new Account(1000);
        final Account b = new Account(2000);
        System.out.println("START: Account a = " + a.getBalance() + ", Account b = " + b.getBalance());


        new Thread( new Runnable() {
            @Override
            public void run() {
                try {
                    transfer( a, b, 500);
                } catch (InsufficientResourcesException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        try {
            transfer( b, a, 300);
        } catch (InsufficientResourcesException e) {
            e.printStackTrace();
        }

//        try {
//            Thread.currentThread().sleep(1000);
//            System.out.println("After DELAY: Account a = " + a.getBalance() + ", Account b = " + b.getBalance());
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        System.out.println("FINISH: Account a = " + a.getBalance() + ", Account b = " + b.getBalance());
    }