加密与解密原理の一例
package lockunlock;
インポート Java.awt.*;
import java.awt.event.*;
import java.Applet.*;
import javax.Swing.*;
import java.util.*;
public class LockUnlock extends JApplet {
private boolean isStandalone = false;
//パラメータ値を取得します。
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//アプレットを構築する
public LockUnlock() {
}
//アプレットを初期化する
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//コンポーネントの初期化
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("文字列の長さ");
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("演習 3");
jButton1.addActionListener(new LockUnlock_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(218, 237, 131, 27));
jButton2.setText("演習 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);
}
//アプレット情報の取得
public String getAppletInfo() {
return "アプレット情報";
}
//パラメータ情報の取得
public String[][] getParameterInfo() {
return null;
}
//Main メソッド
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("アプレットフレーム");
frame.getContentPane().add(applet, BorderLayout.CENTER);
アプレット.init();
applet.start();
frame.setSize(400,320);
寸法 d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
//ルック&フィール設定用の静的イニシャライザ
static {
try {
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch(例外 e) {
}
}
//DataMember を宣言します
int インデックス
//---------------------------- --- ------------------------
JPanel contentPane;
JLabel jLabel1 = new JLabel(); jLabel2 = new JLabel();
JTextField jTextField2 = new JTextField();
JButton jButton1 = 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 関数 (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);
else{
for(int i=1 ; inewSuffix=suffix.substring(1,numOfChars);
newPrefix=prefix suffix.charAt(0); newSuffix,Array);
suffix=newSuffix suffix.charAt(0);
}
}
}
//----------最小値から順に並べる最大値----- -------------
/*public void RankForArrange(int[] Array){
intbottom=Array.length-1; int temp;
for (int i=bottom;i>0;i--){
for(int j=0;jif(Array[j]>配列[j 1]){
temp =配列[j];
配列[j] =配列[j 1]
}
}
}
}
*/
//--------照準番号を見つける-------- ------- ------
public int FindAim(int aim,int[] Array){
boolean isFound=false;
int location=0; =Array.length;
for(int i=0;i
location=i;
}
}
if(isFound)
場所を返す;
else
System.out.println("Not Found"); ※次の場合は返品できません。*/
}
//------文字列の作成---------------- ---------------
public String CreatString(int length){
StringBuffer BufString=new StringBuffer();
for(int i=1;iBufString.append(i) ;
}
return BufString.toString();
}
//-----------OutPut Result---------
public void OutPutResult1() {
インデックス = 0; //0 にクリア
String AimString、プレフィックス;
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);
プレフィックス = ""; //空の文字列を作成します。
if (AimString.length()>>2 &&
AimString.length() Arrange(prefix, AimString, EachArrange) ;
//RankForArrange(EachArrange);
Arrays.sort(EachArrange);
String result = String.valueOf(FindAim(Aim, EachArrange));
jTextField3.setText(結果);
}
else {
System.out.println("文字列が短すぎます");
}
}
//----------出力 結果 2----------- -
public void OutPutRestlt2(){
index=0;//インデックスを0に戻します
String strLength, strMoShu,
AimString, prefix,suffix;
int 長さ, MoShu,limit;
strLength = jTextField2.getText();
strMoShu = jTextField3.getText();
長さ = Integer.parseInt(strLength);
MoShu = Integer.parseInt(strMoShu);
limit = 関数(長さ);
int[] EachArrange = new int[this.function(Length)];
if (Length > 2&&LengthstrLength!=""&&strMoShu!=""
&&MoShu
suffix =CreatString(Length);
Arrange(プレフィックス、サフィックス、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);
}
}

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

AtomエディタMac版ダウンロード
最も人気のあるオープンソースエディター

ドリームウィーバー CS6
ビジュアル Web 開発ツール

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境

EditPlus 中国語クラック版
サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません
