- public static void main(String[] args) {
- int[] a = { 1, 5, 8, 10, 14, 15, 17, 18, 20, 22, 24, 25, 28 };
- int b[] = { 2, 4, 6, 8, 10, 12 };
- int i = 0;
- int j = 0;
- while (i < a.length && j < b.length) {
- if (a[i] < b[j]) {
- i++;
- } else if (a[i] == b[j]) {
- System.out.println(a[i]);
- i++;
- j++;
- } else {
- j++;
- }
- }
- }
- }
~
posted on 2010-08-23 11:37
David1228 阅读(222)
评论(0) 编辑 收藏 所属分类:
JAVA