问个关于JAVA排列组合代码的问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了问个关于JAVA排列组合代码的问题相关的知识,希望对你有一定的参考价值。
小写字母a-z和数字0-9混合组合,把所有的可能显示出来,3位字符
例如aaa,aab,aac....aaz,aa0,aa1,aa2,...zz7,zz8,zz9
完整的代码,这对我初学者来说好困难。。对你们高手来说肯定也就是敲几下键盘的事情。。谢谢了!
public class tt
/**
* @param args
*/
public static void main(String[] args)
String[] arr="a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"
,"0","1","2","3","4","5","6","7","8","9";
int h=0;
for(int i=0;i<arr.length;i++)
for(int j=0;j<arr.length;j++)
for(int k=0;k<arr.length;k++)
System.out.print(arr[i]+arr[j]+arr[k]+" ");
h++;
System.out.println();
unicode编码我忘记了,就直接手写上去了,方正是实现了。呵呵 参考技术A public class TTT
public static void main(String[] args)
String[] s = new String[36];
for (int i = 0; i < 26; i++)
s[i] = String.valueOf((char) (i + 97));
for (int i = 0; i < 10; i++)
s[i + 26] = String.valueOf(i);
for (String k : s)
System.out.println(k);
for (int i = 0; i < 36; i++)
for (int j = 0; j < 36; j++)
for (int k = 0; k < 36; k++)
System.out.println(s[i] + s[j] + s[k]);
以上是关于问个关于JAVA排列组合代码的问题的主要内容,如果未能解决你的问题,请参考以下文章