Java code for 3211 and misc fix