📄 sintable.java
字号:
package javathreads.examples.ch15.example1;
public class SinTable {
private float lookupValues[] = null;
public synchronized float[] getValues() {
if (lookupValues == null) {
lookupValues = new float [360 * 100];
for (int i = 0; i < (360*100); i++) {
float sinValue = (float)Math.sin(
(i % 360)*Math.PI/180.0);
lookupValues[i] = sinValue * (float)i / 180.0f;
}
}
return lookupValues;
}
public static void main(String args[]) {
System.out.println("Starting Example 1 (Control Example)");
SinTable st = new SinTable();
float results[] = st.getValues();
System.out.println("Results: "+ results[0]+ ", "+
results[1]+ ", "+ results[2]+ ", "+ "...");
System.out.println("Done");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -