×î½üÑо¿ÁËÏ·ÖÒ³£¬×ö¸ö×ܽᡣ
1£©Êý¾Ý¿â²Ù×÷Àà,×ö¼òµ¥·â×° DB.java
package Test;
import java.sql.*;
public class DB {
// ¼ÓÔØÇý¶¯
static {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Çý¶¯¼ÓÔØ³ö´í");
}
}
// »ñÈ¡Êý¾Ý¿âÁ¬½Ó
public static Connection getConn() {
Connection conn = null;
try {
conn = DriverManager.getConnection("jdbc:mysql://localhost/userinfo?user=root&password=abcd");
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
// ¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
public st ......
package fileTest;
import java.io.*;
public class FileOperate {
public FileOperate() {
}
public static void main(String args[]){
// newFolder("D:/100");
moveFile("e:/9787030230621-tu06110101(sq) 1.pdf","d:/9787030230621-tu06110101(sq) 1.pdf");
}
/**
* н¨Ä¿Â¼
* @param folderPath String Èç c:/fqf
* @return boolean
*/
public static void newFolder(String folderPath) {
try {
String filePath = folderPath;
filePath = filePath.toString();
java.io.File myFilePath = new java.io.File(filePath); ......
Ò»¡¢java·ÃÎÊÖÐÎÄOracleÊý¾Ý¿âÉÏÁ¬½ÓµÄUS7ASCIIÊý¾Ý¿â
1¡¢¶Á·½·¨
public String convertLink_DB(String s) {
if(s != null){
try{
byte[] b = s.getBytes();
for(int i=0; i<b.length; i++){
b[i] = (byte)(b[i]-128);
}
return new String(b, "gb2312");
}catch(Exception e){
e.printStackTrace();
return "";
}
}
return "";
}
2¡¢Ð´·½·¨
public String convertLink_DB(String s) {
if(s != null){
try{
byte[] b = s.getBytes();
for(int i=0; i<b.length; i++){
b[i] = (byte)(b[i]+128);
}
return new String(b, "gb2312");
}catch(Exception e){
&nb ......
Ò»¡¢java·ÃÎÊÖÐÎÄOracleÊý¾Ý¿âÉÏÁ¬½ÓµÄUS7ASCIIÊý¾Ý¿â
1¡¢¶Á·½·¨
public String convertLink_DB(String s) {
if(s != null){
try{
byte[] b = s.getBytes();
for(int i=0; i<b.length; i++){
b[i] = (byte)(b[i]-128);
}
return new String(b, "gb2312");
}catch(Exception e){
e.printStackTrace();
return "";
}
}
return "";
}
2¡¢Ð´·½·¨
public String convertLink_DB(String s) {
if(s != null){
try{
byte[] b = s.getBytes();
for(int i=0; i<b.length; i++){
b[i] = (byte)(b[i]+128);
}
return new String(b, "gb2312");
}catch(Exception e){
&nb ......
/*
* ººÅµËþ£¬´ÓµÚ1¸öÖù×Ó½èÖúµÚ2¸ùÖù×ÓÒÆ¶¯µ½µÚ3¸ù
*/
public class TowerOfHano {
private int totle;//×ܹ²ÅÌ×ÓÊýÄ¿
public TowerOfHano(int totle){
this.totle=totle;
}
private void moveOne(int start,int end){
System.out.println("´Ó"+start+"ÒÆ¶¯Ò»¿éÅÌ×Óµ½"+end);
}
private void moveAll(int totle,int start,int temp,int end){
if(totle==1){
moveOne(start,end);
}else{
moveAll(totle-1,start,end,temp);
moveOne(start,end);
&n ......
ÔÚAndroidµÄÓ¦ÓóÌÐò¿ª·¢ÖУ¬Í¨³£Ê¹ÓõÄÊÇJAVAÓïÑÔ£¬³ýÁËÐèÒªÊìϤJAVAÓïÑԵĻù´¡ÖªÊ¶Ö®Í⣬»¹ÐèÒªÁ˽âAndroidÌṩµÄÀ©Õ¹µÄJAVA¹¦ÄÜ¡£
ÔÚÒ»°ãµÄJAVAÓ¦ÓÃÖУ¬Èç¹ûÐèÓÃÒýÓûù´¡Àà¿â£¬Í¨³£ÐèҪʹÓÃÈçϵķ½Ê½£º
import
javax.swing.*;
ÒÔÉÏ´úÂë±íʾÁËÒýÓÃJAVAµÄGUI×é¼þSwing,javax.swing¼´JAVAÖеÄÒ»¸ö°ü¡£
androidÌṩһЩÀ©Õ¹µÄJAVAÀà¿â£¬Àà¿â·ÖΪÈô¸É¸ö°ü£¬Ã¿¸ö°üÖаüº¬Èô¸É¸öÀà¡£ÀýÈ磺ÔÚAndroidÖмÆËãÆ÷ÊÇÒ»¸öÏà¶Ô¼òµ¥µÄ³ÌÐò£¬ÆäÈë¿Ú³ÌÐòÎļþΪCalculator.java£¬¸ÃÎļþ°üº¬ÁËÒÔÏÂÄÚÈÝ£º
package com.android.calculator2;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.util.Config;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.content.res.Configuration;
ÔÚAndroidÖУ¬¸÷ÖÖ°üд³Éandroid.*µÄ·½Ê½£¬ÖØÒª°üµÄÃèÊöÈçÏÂËùʾ£º
android.app £ºÌṩ¸ß²ãµÄ³ÌÐòÄ£ÐÍ¡¢Ìṩ»ù±¾µÄÔËÐл·¾³
android.content£º°üº¬¸÷ÖֵĶÔÉ豸ÉϵÄÊý¾Ý½øÐзÃÎʺͷ¢² ......
java ´úÂë
package util;
import java.io.UnsupportedEncodingException;
import dao.socket.OperType;
public class Encrpt {
private String key;
public Encrpt() {
this("sitow");
}
public Encrpt(String key) {
this.key = key;
}
private final String[] reference = new String[] { "0a", "0b", "0c", "0d",
"0e", "0f", "0g", "0h", "0i", "0j", "0k", "0l", "0m", "0n", "0o",
"0p", "0q", "0r", "0s", "0t", "0u", "0v", "0w", "0x", "0y", "0z",
"1a", "1b", "1c", "1d", "1e", "1f", "1g", "1h", "1i", "1j", "1k",
"1l", "1m", "1n", "1o", "1p", "1q", "1r", "1s", "1t", "1u", "1v",
"1w", "1x", "1y", "1z", "2a", "2b", "2c", "2d", "2e", "2f", "2g",
"2h", "2i", "2j", "2k", "2l", "2m", "2n", "2o", "2p", "2q", "2r",
"2s", "2t", "2u", "2v", "2w", "2x", "2y", "2z", "3a", "3b", "3c",
"3d", "3e", "3f", "3 ......
java ´úÂë
package util;
import java.io.UnsupportedEncodingException;
import dao.socket.OperType;
public class Encrpt {
private String key;
public Encrpt() {
this("sitow");
}
public Encrpt(String key) {
this.key = key;
}
private final String[] reference = new String[] { "0a", "0b", "0c", "0d",
"0e", "0f", "0g", "0h", "0i", "0j", "0k", "0l", "0m", "0n", "0o",
"0p", "0q", "0r", "0s", "0t", "0u", "0v", "0w", "0x", "0y", "0z",
"1a", "1b", "1c", "1d", "1e", "1f", "1g", "1h", "1i", "1j", "1k",
"1l", "1m", "1n", "1o", "1p", "1q", "1r", "1s", "1t", "1u", "1v",
"1w", "1x", "1y", "1z", "2a", "2b", "2c", "2d", "2e", "2f", "2g",
"2h", "2i", "2j", "2k", "2l", "2m", "2n", "2o", "2p", "2q", "2r",
"2s", "2t", "2u", "2v", "2w", "2x", "2y", "2z", "3a", "3b", "3c",
"3d", "3e", "3f", "3 ......