As that program becomes more complicated, it is hard to continue it in Ruby, so I rewrite it in Java.