public static void main(String[] args) throws InterruptedException {
        final Random randomizer = new Random();

        final Bank bank = new Bank("Native", Math.abs(randomizer.nextLong()));
        final Account[] accounts = new Account[ACCOUNTS_COUNT];

        double totalAmount = 0.d;

        for (int i = 0; i < accounts.length; i++) {
            accounts[i] = new Account(i, randomizer.nextDouble() * 1200.d);
            totalAmount += accounts[i].getBalance();
        }

        final CountDownLatch latch = new CountDownLatch(1);

        class Worker extends Thread {
            @Override
            public void run() {
                ThreadLocalRandom random = ThreadLocalRandom.current();
                try {
                    latch.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                bank.transfer(accounts[random.nextInt(0, ACCOUNTS_COUNT)],
                        accounts[random.nextInt(0, ACCOUNTS_COUNT)],
                        random.nextDouble(0, 320.d));
            }
        }

        Thread[] threads = new Thread[THREADS_COUNT];
        for (Thread thread : threads) {
            thread = new Worker();
            thread.start();
        }

        latch.countDown();

        for (Thread thread : threads) {
            if (thread != null && thread.isAlive()) thread.join();
        }

        double finalAmount = 0.d;
        for (int i = 0; i < accounts.length; i++) {
            finalAmount += accounts[i].getBalance();
        }
        System.out.println("Initial bank balance was: " + String.format("%.6f", totalAmount));
        System.out.println("Final bank balance is:    " + String.format("%.6f", finalAmount));
    }