P5 code into Java + help in understanding (artwork)

Or is there a simple way to create a similar effect?