- 浏览: 82778 次
- 性别:
- 来自: 武汉
最新评论
-
yuanliangding:
有没有办法改呢。
使用反射修改final属性 -
风雪木易:
a并没有改变,用a.getter访问,别用field.get( ...
使用反射修改final属性 -
lylegend13:
哈包祥明 写道可以问一下 这篇文章要说明什么》》???
AC ...
1012 -
哈包祥明:
可以问一下 这篇文章要说明什么》》???
1012 -
gengu:
你写代码注释都不带的??
KMP
文章列表
1
public class test {
public static void main(String[] args) {
A a = new A();
System.out.println(a.v);// 0
setValue(a);
System.out.println(a.v);// 1
setA(a);
System.out.println(a.v);// 1
}
public static void setValue(A a) {
a.v = 1;
}
public static void se ...
public class test {
public static void main(String[] args) {
int N = 10;
int[] a = new int[N];
for (int i = 0; i < N; i++) {
a[i] = (int) (Math.random() * 100);
System.out.print(a[i] + "\t");
}
System.out.println();
sort(a, N - 1);
for (int i = 0 ...
public class test {
public static void main(String[] args) {
int N = 10;
int[] a = new int[N];
for (int i = 0; i < N; i++) {
a[i] = (int) (Math.random() * 100);
System.out.print(a[i] + "\t");
}
System.out.println();
sort(a, N - 1);
for (int i = 0 ...
public class test {
public static void main(String[] args) {
int N = 10;
int[] a = new int[N];
for (int i = 0; i < N; i++) {
a[i] = (int) (Math.random() * 100);
System.out.print(a[i] + "\t");
}
System.out.println();
sort(a, 0, N - 1);
for (int i ...
大于某数的相邻两位数不同的最小整数
- 博客分类:
- Java
题目地址:http://news.bangkaow.com/news/20110812/227061.html
题目简述:求大于某个整数n的相邻两位数不同的最小的整数。
public class test {
public static void main(String[] args) {
// int num = (int) (Math.random() * 10000000);
int num = 9899;
System.out.println(num);
System.out.println(getResult(num));
}
...
public class test {
public static void main(String[] args) {
int N = 10;
int[] a = new int[N];
for (int i = 0; i < N; i++) {
a[i] = (int) (Math.random() * 100);
System.out.print(a[i] + "\t");
}
System.out.println();
sort(a, 0, N - 1);
for (int i ...
POI读取Excel的实际行
- 博客分类:
- POI
通过getPhysicalNumberOfRows()获得的实际行数,不一定有数据的行数。
比如某个单元格只设置了非“常规”的格式,它也会被POI认为是实际行。
不过POI里似乎没有没有这样的方法,getNextPhysicalRow()。
所以只好从getFirstRowNum()到getLastRowNum()遍历,如果null==currentRow,验证下一行。
try {
Workbook hwb = new HSSFWorkbook(
new FileInputStream("C:\\1.xls"));
Shee ...
仿别人的过的
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[] a = new int[4];
Scanner s = new Scanner(System.in);
int no = 1;
while (true) {
boolean end = true;
for (int i = 0; i < 4; i++) {
a[i] = s.nextInt();
if (a ...
为了测试数据,在网上看了好多思想,还是坚持自己最初的想法,字符转成数组。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (s.hasNext()) {
for (int i = s.nextInt(); i >= 1; i--) {
int[] a = new int[12];// 把字符对应成int数组
int ...
原理: PI*r*r/2 <= 50*年数
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (true) {
int row = s.nextInt();
for (int i = 1; i <= row; i++) {
float x = s.nextFloat();
float y = s.nextFloat ...
从1打到13
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
for (int i = 1; i < 14; i++) {
System.out.println(i + "\t" + exec(i));
}
}
public int exec(int n) {
for (int i = 0;; i += n + 1) {
if (check(n, n + 1 ...
仿人的,很奇怪1、2、3一处也不能少,但没找着少了之后结果会不同的测试数据
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
Scanner s = new Scanner(System.in);
while (true) {
BigDecimal n = s.nextBigDecimal();
...
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
Scanner s = new Scanner(System.in);
float n;
while ((n = s.nextFloat()) != 0) {
int i = 1;
while ((n -= (1.0 / ++i)) > 0) {
}
System.out.pri ...
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main();
}
int count;// 数字个数
int[] a;
boolean[] b;
int L;// 当前匹配长度
...
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.TreeMap;
public class Main1 {
public static void main(String[] args) {
new Main1();
}
int l;
p ...