12 2015 档案
摘要:1、如果遇到相等的值不进行交换,那这种排序方式是稳定的排序方式。 2、原理:比较两个相邻的元素,将值大的元素交换到右边。 3、思路:依次比较相邻的两个数,将比较小的数放在前面,比较大的数放在后面。 (1)第一次比较:首先比较第1个数和第2个数,将小数放在前面,大数放在后面。 (2)比较第2和第3个数
阅读全文
摘要:1、穷举算法( primeList = new ArrayList(); int count = 0; // Count the number of prime numbers int number = 2; // A number to be tested for pr...
阅读全文
摘要:1、穷举算法 时间复杂度(O(n))// 从小到大public static int gcd(int m, int n) { int gcd = 1; for (int i = 2; i = 1; i--) { if (m % i == 0 && ...
阅读全文
摘要:1、递归方法 时间复杂度(O(2n))public static long fibonacci(long index) { if (index == 0) { return 0; } else if (index == 1) { ...
阅读全文
摘要:两种方法:一个是使用btye数组(GB2312仅包含常用字,所以会存在失败的情况,推荐使用jar包),一个是引入jar包进行操作。 1、 2、
阅读全文
摘要:1、GenericMatrix类public abstract class GenericMatrix { /** * Abstract method for adding two elements of the matrices * @param o1 * @param o2 * @ret...
阅读全文
摘要:由于泛型类型在运行时被消除,因此,对于如何使用泛型类型是有一些限制的。 限制1:不能使用new E() 不能使用泛型类型参数创建实例。例如,下面的语句是错误的: E object = new E(); 出错的原因是运行时执行的是new E(),但是运行时泛型类型E是不可用的。 限制2:不能使用new
阅读全文
摘要:Java泛型中的标记符含义:E- Element (在集合中使用,因为集合中存放的是元素)T- Type(Java 类)K- Key(键)V- Value(值)N- Number(数值类型)?- 表示不确定的java类型S、U、V- 2nd、3rd、4th typesObject跟这些标记符代表的j...
阅读全文
摘要:// Finite +-0.0 System.out.println("Finite with +-0.0:"); System.out.println("Finite / +-0.0: " + 8.0 / 0.0); System.out.println("Finite / +-0.0: "...
阅读全文
摘要:1、相同目录下 指定applet类名称,applet的宽度和高度。 2、不同路目下 添加指定applet所在目录。在浏览器中查看,或使用applet查看器工具查看(appletviewer*.class);
阅读全文
摘要:1、在正常情况下windowClosed方法不执行;2、调用dispose方法,windowClosed方法会执行。例如:在windowClosing方法中执行dispose方法,windowClosed方法执行;3、在windowClosing方法中执行dispose方法,如果使用了frame.s...
阅读全文
摘要:import java.math.BigInteger;public class Rational extends Number implements Comparable { private BigInteger numerator;// 分子 private BigInteger denomin...
阅读全文
摘要:public class Rational extends Number implements Comparable { private long numerator;// 分子 private long denominator;// 分母 /** * @param args */ public...
阅读全文
摘要:1、BigInteger(byte[] val)这个构造函数用于转换一个字节数组包含BigInteger的二进制补码,以二进制表示成一个BigInteger。(用字节数组中值的ASCII码构造BigInteger)2、BigInteger(int signum, byte[] magnitude)此...
阅读全文
摘要:public static int gcd(int a, int b) { int n1 = Math.abs(a); int n2 = Math.abs(b); int remainder = n1 % n2; while (remainder > 0) { n1 = n2; n2 ...
阅读全文

浙公网安备 33010602011771号