Java tutorial
//package com.java2s; public class Main { public static float[] rotate2d(float x0, float y0, float th) { float cos = (float) Math.cos(th); float sin = (float) Math.sin(th); float x = x0 * cos - y0 * sin;//x' = x*cos b - y*sin b float y = x0 * sin + y0 * cos;//y' = x*sin b + y*cos b return new float[] { x, y }; } }