Could not transfer artifact junit:junit:pom:4.13 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/junit/junit/4.13/junit-4.13.pom

Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.5.6 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.5.6/spring-boot-starter-parent-2.5.6.pom

错误原因未 开启了 charles 无法下载包。关闭charles就可以了

稀疏函数实现

package array;

public class sparseArray {
public static void main(String[] args) {
sparse();
}

public static void sparse() {
int length = 11;
int[][] array1 = new int[length][length];
array1[2][3] = 1;
array1[3][4] = 2;
System.out.println("原始数组");
prints(array1);

System.out.println("转为稀疏数组");
int sum = 0;//系数数组的个数
for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1.length; j++) { if (array1[i][j] != 0) { sum += 1; } } } int[][] array2 = new int[sum + 1][3]; array2[0][0] = length; array2[0][1] = length; array2[0][2] = sum; //赋值稀疏数组 int count = 0; for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1[i].length; j++) { if (array1[i][j] != 0) { count++; array2[count][0] = i; array2[count][1] = j; array2[count][2] = array1[i][j]; } } } prints(array2); System.out.println("还原稀疏数组"); int[][] array3 = new int[length][length]; for (int i = 1; i < array2.length; i++) { array3[array2[i][0]][array2[i][1]] = array2[i][2]; } prints(array3); } public static void prints(int[][] array) { for (int[] ints : array) { for (int anInt : ints) { System.out.print(anInt + "\t"); } System.out.println(); } } }

我的tomcat9放在c盘,项目想放到d盘。如下操作

1.创建目录 D:\program\web 并把tomcat项目中的的WEB_INF考入其目录下

2.修改tomcat/conf/server.xml  在host目录内添加一行 <Context path=”/web” docBase=”D:\program\web” />

重启tomcat就可以了

这时候出现了404。想要把web目录list显示出来。修改一下tomcat/conf/web.xml如下,并重启

<param-name>listings</param-name>
<param-value>true</param-value>