㈠ 新手java应该怎么学
新手想学好Java,需要一份完整的Java学习路线图。下面分享一份Java全套的的学习路线,仅供参考
如果想入行Java开发行业,却苦于自己没有基础,担心自己学不会,可以选择专业的学习,一般学习费用在2W左右,也有线上的相关学习。Java学习可以从基础开始,零基础学习并不可怕,一般4-6个左右的时间,只要你肯努力,一切都不是事。
㈡ 用java实现des算法
分类: 电脑/网络 >> 程序设计 >> 其并运他编程语言
问题描述:
各位好,请求各位java学习者帮助钉解决这个问题。
我想用des算法对我的名字进行加密
我也在网上下载了des算法,包括FileDES,SubKey,Des各程序,
可能没真正理解这些程序,所以我想调用都键让不知道将这些东西
组合起来,有知道的请帮帮忙啊!
解析:
package des;
import java.io.*;
import java.nio.*;
import java.nio.channels.FileChannel;
public class FileDES{
private static final boolean enc=true; 加密
private static final boolean dec=false; 解密
private String srcFileName;
private String destFileName;
private String inKey;
private boolean actionType;
private File srcFile;
private File destFile;
private Des des;
private void *** yzePath(){
String dirName;
int pos=srcFileNamestIndexOf("/稿蔽局");
dirName=srcFileName.substring(0,pos);
File dir=new File(dirName);
if (!dir.exists()){
System.err.println(dirName+" is not exist");
System.exit(1);
}else if(!dir.isDirectory()){
System.err.println(dirName+" is not a directory");
System.exit(1);
}
pos=destFileNamestIndexOf("/");
dirName=destFileName.substring(0,pos);
dir=new File(dirName);
if (!dir.exists()){
if(!dir.mkdirs()){
System.out.println ("can not creat directory:"+dirName);
System.exit(1);
}
}else if(!dir.isDirectory()){
System.err.println(dirName+" is not a directory");
System.exit(1);
}
}
private static int replenish(FileChannel channel,ByteBuffer buf) throws IOException{
long byteLeft=channel.size()-channel.position();
if(byteLeft==0L)
return -1;
buf.position(0);
buf.limit(buf.position()+(byteLeft<8 ? (int)byteLeft :8));
return channel.read(buf);
}
private void file_operate(boolean flag){
des=new Des(inKey);
FileOutputStream outputFile=null;
try {
outputFile=new FileOutputStream(srcFile,true);
}catch (java.io.FileNotFoundException e) {
e.printStackTrace(System.err);
}
FileChannel outChannel=outputFile.getChannel();
try{
if(outChannel.size()%2!=0){
ByteBuffer bufTemp=ByteBuffer.allocate(1);
bufTemp.put((byte)32);
bufTemp.flip();
outChannel.position(outChannel.size());
outChannel.write(bufTemp);
bufTemp.clear();
}
}catch(Exception ex){
ex.printStackTrace(System.err);
System.exit(1);
}
FileInputStream inFile=null;
try{
inFile=new FileInputStream(srcFile);
}catch(java.io.FileNotFoundException e){
e.printStackTrace(System.err);
System.exit(1);
}
outputFile=null;
try {
outputFile=new FileOutputStream(destFile,true);
}catch (java.io.FileNotFoundException e) {
e.printStackTrace(System.err);
}
FileChannel inChannel=inFile.getChannel();
outChannel=outputFile.getChannel();
ByteBuffer inBuf=ByteBuffer.allocate(8);
ByteBuffer outBuf=ByteBuffer.allocate(8);
try{
String srcStr;
String destStr;
while(true){
if (replenish(inChannel,inBuf)==-1) break;
srcStr=((ByteBuffer)(inBuf.flip())).asCharBuffer().toString();
inBuf.clear();
if (flag)
destStr=des.enc(srcStr,srcStr.length());
else
destStr=des.dec(srcStr,srcStr.length());
outBuf.clear();
if (destStr.length()==4){
for (int i = 0; i<4; i++) {
outBuf.putChar(destStr.charAt(i));
}
outBuf.flip();
}else{
outBuf.position(0);
outBuf.limit(2*destStr.length());
for (int i = 0; i<destStr.length(); i++) {
outBuf.putChar(destStr.charAt(i));
}
outBuf.flip();
}
try {
outChannel.write(outBuf);
outBuf.clear();
}catch (java.io.IOException ex) {
ex.printStackTrace(System.err);
}
}
System.out.println (inChannel.size());
System.out.println (outChannel.size());
System.out.println ("EoF reached.");
inFile.close();
outputFile.close();
}catch(java.io.IOException e){
e.printStackTrace(System.err);
System.exit(1);
}
}
public FileDES(String srcFileName,String destFileName,String inKey,boolean actionType){
this.srcFileName=srcFileName;
this.destFileName=destFileName;
this.actionType=actionType;
*** yzePath();
srcFile=new File(srcFileName);
destFile=new File(destFileName);
this.inKey=inKey;
if (actionType==enc)
file_operate(enc);
else
file_operate(dec);
}
public static void main(String[] args){
String file1=System.getProperty("user.dir")+"/111.doc";
String file2=System.getProperty("user.dir")+"/222.doc";
String file3=System.getProperty("user.dir")+"/333.doc";
String passWord="1234ABCD";
FileDES fileDes=new FileDES(file1,file2,passWord,true);
FileDES fileDes1=new FileDES(file2,file3,passWord,false);
}
㈢ 新手初学Java有必要去学习数据结构与算法吗
还是有些必要的,大公司笔试面试基本都是靠计算机网络及数据结构与算法。
建议找些基础的算法如排序查找等入门就可以了,java新人用不到多深层次的算法,
新人初学Java的话建议还是讲基础知识弄通弄透比较好。
㈣ 小白该如何学习java算法
其实算法看起来很高深,听起来很遥远。学习算法,看你以后要做什么。我个人觉得没有必要成天想着如何学习算法。而是根据客户的需求做出想要的东西。当你遇到一个问题没法解决的时候你就上网搜索一下。你会进步的更快。总之,学以致用。需要使用再学习。这个是相互的。
㈤ java学习主要是学习什么呢
你好,学习java只要掌握好方式和方法,其实学起来并不是非常难。比如你可以自学也可以选择机构学。
java是目前主流的开发语言,程序员不论是大数据、云计算、web前端、后端开发等都需要从java学起,如果你想计入IT高薪行列,建议学java!
java学的内容主要有:
①JAVA编程基础(基础语法、面向对象、和谐特性等)
②WEB应用开发(静态网页制作、Oracle数据库、Java Web开发技术、Linux技术、网站性能与安全、软件工程开发流程、Java Web和谐等)
③企业级框架开发(数据结构与算法、SSH框架、JavaEE和谐等)
④项目实训
互联网行业目前还是最热门的行业之一,学习IT技能之后足够优秀是有机会进入腾讯、阿里、网易等互联网大厂高薪就业的,发展前景非常好,普通人也可以学习。
想要系统学习,你可以考察对比一下开设有相关专业的热门学校,好的学校拥有根据当下企业需求自主研发课程的能力,能够在校期间取得大专或本科学历,中博软件学院、南京课工场、南京北大青鸟等开设相关专业的学校都是不错的,建议实地考察对比一下。
祝你学有所成,望采纳。