Pythonの配列処理をJavaで書く ref: http://qiita.com/mountcedar/items/40d82cc52d0db1c2c49b