JAVA最短路径代码
import java.util.LinkedList;
import java.util.List;
public class ShortestPaths {
private static String showPath[] = { "", "", "", "", "", "" };
// 返回图的最短路径
public static int[] getShortPath(int path[][]) {
LinkedList<Integer> savePath = new LinkedList<Integer>();// 用于保存已添加进来的节点
int mark = 1;
int shortestPath[] = new int[path.length];
for (int i = 0; i < shortestPath.length; i++) {
shortestPath[i] = -1;
}
savePath.add(new Integer(0));
if (savePath.size() == 1) {
int num = savePath.getLast().intValue();
int minIndex = 0;
for (int j = 0; j < shortestPath.length; j++) {
shortestPath[j] = path[num][j];
相关文档:
1. 先写一个Singleton的class
package stone;
public class Singleton {
private static Singleton instance;
private Singleton() {}
public static Singleton getInstance(){
if(instance==null)
&n ......
JXL(Java Excel API)是一个用来动态读写Excel文件的开源框架,利用它可以在任何支持Java的操作系统上动态读写Excel文件。JXL的主页是:http://www.andykhan.com/jexcelapi/,可以在这里下载到它的最新的版本。
你可以分别通过如下命令
java -jar jxl.jar -xml test.xls
java -jar jxl.jar -cvs test.xls
以xml ......
本文主要谈一下密码学中的加密和数字签名,以及其在java中如何进行使用。对密码学有兴趣的伙伴,推荐看Bruce Schneier的著作:Applied Crypotography.在jdk1.5的发行版本中安全性方面有了很大的改进,也提供了对RSA算法的直接支持,现在我们从实例入手解决问题(本文仅是作为简单介绍):
一、密码学上 ......
1.字符
x 字符 x。例如a表示字符a
\\ 反斜线字符。在书写时要写为\\\\。(注意:因为java在第一次解析时,把\\\\解析成正则表达式\\,在第二次解析时再解析为\,所以凡是不是1.1列举到的转义字符,包括1.1的\\,而又带有\的都要写两次)
\0n 带有八进制值 0的字符 ......