気が付けば,12月ももう半ば.
年賀状もまだ書いてないですよ.
買った:「少年アリス」,坂本真綾,まだあんまり聞いてない.
メモ:「R.O.D the TV vol.3」,12/17
java メモ
参考:java便利帳
数式
Math.PI pi
Math.sin() sine
Math.atan() arc tangent
Math.pow() power
Math.sqrt() square root
数字を丸める
private static double rDeci(double arg) {
return ((int)(arg * 1000 + 0.5)) / (double) 1000;
}
有効桁数でイコール判定
private static boolean eqr(double x, double y) {
if (rDeci(x – y) == 0)
return (true);
else
return (false);
}
指定ビットを取り出す
public byte getBit(int Num, int modulo) {
int keta, me;
keta = 8 – modulo – 1;
me = Num & (byte) Math.pow(2, keta) ;
return (byte) (me / Math.pow(2, keta));
}
標準出力
System.out.println(“// org edge file: “);
強制終了
System.exit(0);
文字列化
String.valueOf(double arg)
文字列の部分文字列である新たな文字列を返す
substring(int beginIndex, int endIndex)
String st = “nannka tekito na mojiretu”;
System.out.println(st.substring(st.length() – 4, st.length()));
File Sseparator
String sep = File.separator;
current directory
System.getProperty(“user.dir”);
フルパスを取り出す
File f;
FileFullPath = f.getCanonicalPath();
java version
System.getProperty(“java.version”);
os name
System.getProperty(“os.name”);
os version
System.getProperty(“os.version”);
date
DateFormat df = DateFormat.getDateTimeInstance();
String date = df.format(new Date());