Jave remake of the codes in pattern design.