📄 example8_3.java
字号:
/*
* Example8_3.java
*
* Created on 2006年9月16日, 上午10:26
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package example8_3;
import java.util.Arrays; //导入Arrays类
/**
*
* @author Administrator
*/
public class Example8_3 {
/** Creates a new instance of Example8_3 */
public Example8_3() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic
int vec[] = {-5, 19, 23, 37, 47, 56};
int slot = Arrays.binarySearch(vec, 35); //折半法查找35在数组vec中的位置
slot = -(slot + 1); //插入点位置
System.out.println("insertion point = "+ slot);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -