factorial.java working