public class Test12 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.println("请输入一个字符串:"); String str = input.next(); for (int…
//输入字符串然后与自己定义的数组进行对比,并输出重复次数. public class Test11 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("请输入字符串:"); String num = input.next(); char[] array =…
public int binarySearch(int[] data,int aim){//以int数组为例,aim为需要查找的数 int start = 0; int end = data.length-1; int mid = (start+end)/2;//a while(data[mid]!=aim&&end>start){//如果data[mid]等于aim则死循环,所以排除 if(data[mid]>aim){ end = mid-1; }else if(data[…
import java.util.Scanner;public class Test_while { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); /*int sum=0; int score=0; int c…
import java.util.Scanner;public class threeTest { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("请输入第一条边:"); int a = input.nextInt(); System.out.println("请…
import java.util.Scanner;public class Test15 { public static void main(String[] args) { // TODO Auto-generated method stub for (int i = 0; i < 1000; i++) { if (i % 3 == 0) { System.out.print(i+&quo…
import java.util.Scanner;public class Test13 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int number = 0; do{ System.out.printl…