Simple Union Find Code in Java