㈠ 新手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技能之後足夠優秀是有機會進入騰訊、阿里、網易等互聯網大廠高薪就業的,發展前景非常好,普通人也可以學習。
想要系統學習,你可以考察對比一下開設有相關專業的熱門學校,好的學校擁有根據當下企業需求自主研發課程的能力,能夠在校期間取得大專或本科學歷,中博軟體學院、南京課工場、南京北大青鳥等開設相關專業的學校都是不錯的,建議實地考察對比一下。
祝你學有所成,望採納。