随笔分类 - Java
摘要:1 import java.io.*; 2 3 /* 4 * 问题描述:将正整数N(N>=1)转换成二进制数 5 * 例 11 = 1* 2^3 + 0* 2^2 + 1* 2^1 + 1 6 */ 7 8 public class Decimal2Binary { 9 10 // 这里初始的"1"表示二进制1、0串中始终存在的最高位的111 private static String str = "1";12 13 // 递归地判断最后一位是1还是0,然后右移一位14 private static void conv(int n) {15 ...
阅读全文
摘要:这是一个简单的问题,大一刚学编程的时候做的笔记。打印出从1、2、3……n中取出r个数的不同组合(n>=r>=1)例如n=3,r=2,输出:1,22,3下面是实现的代码:public class Combination { public static void combine(int[] list, int k, int l, int r, int n) { if (k + l > n + 1) return; if (l == 0) { for (int i = 0; i < r; i++) ...
阅读全文
摘要:转自Oracle官网上的Swing Tutorial: 1 package components; 2 3 /** 4 * This application that requires the following additional files: 5 * TreeDemoHelp.html 6 * arnold.html 7 * bloch.html 8 * chan.html 9 * jls.html 10 * swingtutorial.html 11 * tutorial.html 12 * t...
阅读全文
浙公网安备 33010602011771号