finish s5 java code