찾다
php教程php手册java EJB 加密与解密原理的一个例子

java EJB 加密与解密原理的一个例子

Jun 13, 2016 pm 12:30 PM
ejbjava그리고암호화원칙~의암호 해독

加密与解密原理的一个例子

package lockunlock; 

import Java.awt.*; 
import java.awt.event.*; 
import java.Applet.*; 
import javax.Swing.*; 
import java.util.*; 
public class LockUnlock extends JApplet { 
private boolean isStandalone = false; 
//Get a parameter value 
public String getParameter(String key, String def) { 
return isStandalone ? System.getProperty(key, def) : 
(getParameter(key) != null ? getParameter(key) : def); 


//Construct the applet 
public LockUnlock() { 

//Initialize the applet 
public void init() { 
try { 
jbInit(); 

catch(Exception e) { 
e.printStackTrace(); 


//Component initialization 
private void jbInit() throws Exception { 
contentPane = (JPanel) this.getContentPane(); 
jLabel1.setText("String"); 
jLabel1.setBounds(new Rectangle(35, 36, 57, 21)); 
contentPane.setLayout(null); 
this.setSize(new Dimension(400, 300)); 
jLabel2.setText("String length"); 
jLabel2.setBounds(new Rectangle(29, 73, 69, 22)); 
jTextField1.setText(""); 
jTextField1.setBounds(new Rectangle(108, 40, 166, 17)); 
jTextField2.setText(""); 
jTextField2.setBounds(new Rectangle(107, 72, 56, 21)); 
jButton1.setBounds(new Rectangle(30, 236, 137, 27)); 
jButton1.setText("Exercise 3"); 
jButton1.addActionListener(new LockUnlock_jButton1_actionAdapter(this)); 
jButton2.setBounds(new Rectangle(218, 237, 131, 27)); 
jButton2.setText("Exercise 4"); 
jButton2.addActionListener(new LockUnlock_jButton2_actionAdapter(this)); 
jTextField3.setText(""); 
jTextField3.setBounds(new Rectangle(106, 105, 58, 21)); 
jLabel3.setText("MoShu"); 
jLabel3.setBounds(new Rectangle(36, 106, 86, 18)); 
contentPane.add(jLabel1, null); 
contentPane.add(jButton2, null); 
contentPane.add(jButton1, null); 
contentPane.add(jLabel3, null); 
contentPane.add(jTextField2, null); 
contentPane.add(jLabel2, null); 
contentPane.add(jTextField3, null); 
contentPane.add(jTextField1, null); 


//Get Applet information 
public String getAppletInfo() { 
return "Applet Information"; 

//Get parameter info 
public String[][] getParameterInfo() { 
return null; 

//Main method 
public static void main(String[] args) { 
LockUnlock applet = new LockUnlock(); 
applet.isStandalone = true; 
JFrame frame = new JFrame(); 
//EXIT_ON_CLOSE == 3 
frame.setDefaultCloseOperation(3); 
frame.setTitle("Applet Frame"); 
frame.getContentPane().add(applet, BorderLayout.CENTER); 
applet.init(); 
applet.start(); 
frame.setSize(400,320); 
Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2); 
frame.setVisible(true); 


//static initializer for setting look & feel 
static { 
try { 
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); 

catch(Exception e) { 


//Declare DataMember 
int index; 

//----------------------------------------------------- 
JPanel contentPane; 
JLabel jLabel1 = new JLabel(); 
JLabel jLabel2 = new JLabel(); 
JTextField jTextField2 = new JTextField(); 
JTextField jTextField1 = new JTextField(); 
JButton jButton1 = new JButton(); 
JButton jButton2 = new JButton(); 
JTextField jTextField3 = new JTextField(); 
JLabel jLabel3 = new JLabel(); 

//----------------------N!------------------------------ 
public int function(int N){ 
if(N==1) 
return 1; 
else{ 
return N*function(N-1); 
/*不是RETURN function(N-1); 
而是 N*function(N-1);*/ 


//-----------用递归法求一个串的全排列----------------------- 
public void Arrange(String prefix,String suffix,int[] Array){ 
String newPrefix,newSuffix; 
int numOfChars =suffix.length(); 
if(numOfChars==1){ 
Array[index]=Integer.parseInt(prefix+suffix); 
index++; 

else{ 
for(int i=1; inewSuffix=suffix.substring(1,numOfChars); 
newPrefix=prefix+suffix.charAt(0); 
Arrange(newPrefix,newSuffix,Array); 
suffix=newSuffix+suffix.charAt(0); 



//----------Arrange From the Min to the Max------------------ 
/*public void RankForArrange(int[] Array){ 
int bottom=Array.length-1 ; 
int temp; 
for(int i=bottom;i>0;i--){ 
for(int j=0;jif(Array[j]>Array[j+1]){ 
temp =Array[j]; 
Array[j] =Array[j+1]; 
Array[j+1]=temp; 




*/ 
//-------------------Find the aim number---------------------- 
public int FindAim(int aim,int[] Array){ 
boolean isFound=false; 
int location=0; 
int length=Array.length ; 
for(int i=0;iif(Array[i]==aim){ 
location=i; 
isFound =true; 


if(isFound) 
return location; 
else 
System.out.println("Not Found"); 
return location; 
/*在if里return 不行吗?*/ 


//------------------Creat String------------------------------- 
public String CreatString(int length){ 
StringBuffer BufString=new StringBuffer(); 
for(int i=1;iBufString.append(i) ; 

return BufString.toString(); 

//-----------OutPut Result-------------------- 
public void OutPutResult1(){ 
index = 0; //clear to 0 
String AimString, prefix; 
AimString = jTextField1.getText(); 
int Length = AimString.length(); 
String strLength = String.valueOf(Length); 
int Aim = Integer.parseInt(AimString); 
/* 方法.parseInt才是转换为int类型 
而不是.getInteger*/ 
int[] EachArrange = new int[this.function(Length)]; 
jTextField2.setText(strLength); 
prefix = ""; //Make an empty String 
if (AimString.length() > 2 && 
AimString.length() Arrange(prefix, AimString, EachArrange); 
//RankForArrange(EachArrange); 
Arrays.sort(EachArrange); 
String result = String.valueOf(FindAim(Aim, EachArrange)); 
jTextField3.setText(result); 

else { 
System.out.println("Your String is too short"); 



//----------Out put result 2--------------------- 
public void OutPutRestlt2(){ 
index=0;//Let index come back to 0 
String strLength, strMoShu, 
AimString, prefix,suffix; 
int Length, MoShu,limit; 
strLength = jTextField2.getText(); 
strMoShu = jTextField3.getText(); 
Length = Integer.parseInt(strLength); 
MoShu = Integer.parseInt(strMoShu); 
limit = function(Length); 
int[] EachArrange = new int[this.function(Length)]; 
if (Length > 2&&LengthstrLength!=""&&strMoShu!="" 
&&MoShuprefix = ""; 
suffix =CreatString(Length); 
Arrange(prefix, suffix, EachArrange); 
Arrays.sort(EachArrange); 
String strResult=String.valueOf(EachArrange[MoShu]); 
jTextField1.setText(strResult); 

else 
System.out.println("Input Ouf MoShu, Try again") ; 


void jButton1_actionPerformed(ActionEvent e) { 
this.OutPutResult1(); 


void jButton2_actionPerformed(ActionEvent e) { 
this.OutPutRestlt2(); 

//----------------------------------------------------------- 



class LockUnlock_jButton1_actionAdapter implements java.awt.event.ActionListener { 
LockUnlock adaptee; 

LockUnlock_jButton1_actionAdapter(LockUnlock adaptee) { 
this.adaptee = adaptee; 

public void actionPerformed(ActionEvent e) { 
adaptee.jButton1_actionPerformed(e); 



class LockUnlock_jButton2_actionAdapter implements java.awt.event.ActionListener { 
LockUnlock adaptee; 

LockUnlock_jButton2_actionAdapter(LockUnlock adaptee) { 
this.adaptee = adaptee; 

public void actionPerformed(ActionEvent e) { 
adaptee.jButton2_actionPerformed(e); 

}

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

DVWA

DVWA

DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경