Javaに投稿されたコード一覧
float x;void setup() {size(400, 330);background(255);
void setup() {try {println(File.createTempFile("tmp", "").getParent());println(System.getProperty("java.io.tmpdir"));File[] files =File.createTempFile("tmp", "").getParentFile().listFiles(new P5FileFilter());
ArrayList list = new ArrayList();//ArrayListという配列の拡張版のようなものを使います。list.add("a");//配列に文字列つまりString型のオブジェクトを入れます//String a= list.get(0);//エラーです。listからgetするとObject型で取ってきますので型が合わない為です。String a= (String)list.get(0);//0番目の要素を取得、String型でキャストします。print(a);
import java.util.ArrayList;public class MultipleAlignment {public static final double MATCH = 2.0;
public final float random(float howbig) {// for some reason (rounding error?) Math.random() * 3// can sometimes return '3' (once in ~30 million tries)// so a check was added to avoid the inclusion of 'howbig'