Added Problem1 in java