Updated JAva Code