十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無(wú)憂售后,網(wǎng)站問(wèn)題一站解決
java 自動(dòng)填充網(wǎng)頁(yè)上的用戶名和密碼有兩種方法:

創(chuàng)新互聯(lián)建站始終堅(jiān)持【策劃先行,效果至上】的經(jīng)營(yíng)理念,通過(guò)多達(dá)十余年累計(jì)超上千家客戶的網(wǎng)站建設(shè)總結(jié)了一套系統(tǒng)有效的網(wǎng)絡(luò)營(yíng)銷推廣解決方案,現(xiàn)已廣泛運(yùn)用于各行各業(yè)的客戶,其中包括:PE包裝袋等企業(yè),備受客戶贊揚(yáng)。
方法一、在input 標(biāo)簽里面的 value屬性賦值即可,如:
input?value='x'?//這樣就每次打開都自動(dòng)填充x
方法二、用java模擬post提交;代碼如下;
package?com.sxzl.test;
public?class?TestRuntime?{
public?static?void?main(String?args[])?{?
try?{?
//String?myArgs[]?={"
};
Process?process?=?Runtime.getRuntime().exec(?
//"cmd.exe?/c?start?
"C:\\Program?Files\\Internet?Explorer\\iexplore.exe"????
+"?
);?
}?catch?(Exception?e)?{?
e.printStackTrace();?
}?
}?
}
import java.util.Arrays;
public class Array2 {
public static void main(String[] args) {
//聲明一個(gè)名為myArray的數(shù)組,該數(shù)組有2行,每行列數(shù)不等,并為其分配內(nèi)存空間
int[][] myArray = new int[2][];
myArray[0] = new int[5]; //第一行有5個(gè)元素,并為其分配內(nèi)存空間
myArray[1] = new int[10]; //第二行有10個(gè)元素,并為其分配內(nèi)存空間
for (int j = 0; j myArray[0].length; j++)
//用1-10之間的隨機(jī)整數(shù)給第一行元素賦值
myArray[0][j] = (int)(Math.random() * 10);
//用100-200之間的隨機(jī)整數(shù)給第二行元素賦值
for (int j=0; j myArray[1].length; j++)
myArray[1][j]=(int)(Math.random() * 100 + 100);
for (int i=0; i myArray.length; i++){ //輸出myArray數(shù)組各元素的值
for (int j=0; j myArray[i].length; j++){
System.out.print(myArray[i][j]+" ");
}
System.out.println();
}
Arrays.sort(myArray[0]); //對(duì)第一行元素排序
Arrays.sort(myArray[1]); //對(duì)第二行元素排序
System.out.println("\n排序后的數(shù)組元素: ");
for (int i=0; imyArray.length;i++){ //再次輸出myArray數(shù)組各元素的值
for (int j=0; jmyArray[i].length;j++){
System.out.print(myArray[i][j]+" ");
}
System.out.println();
}
}
}
7 3 9 6 7
103 165 166 148 103 179 128 109 120 156
排序后的數(shù)組元素:
3 6 7 7 9
103 103 109 120 128 148 156 165 166 179
java里面使用string.format實(shí)現(xiàn)空格右填充代碼如下:
package cn.com.songjy;
import java.text.NumberFormat;
public class NumberFormatTest {
public static void main(String[] args) {
int i = 1;
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
nf.setMaximumIntegerDigits(4);
nf.setMinimumIntegerDigits(4);
System.out.println(nf.format(i));
}
}
public class TestStringFormat {?
public static void main(String[] args) {
int youNumber = 1;
String str = String.format("%04d", youNumber);?
System.out.println(str); // 0001
}
}
private static final String STR_FORMAT = "0000";
public static String haoAddOne_2(String liuShuiHao){
Integer intHao = Integer.parseInt(liuShuiHao);
intHao++;
DecimalFormat df = new DecimalFormat(STR_FORMAT);
return df.format(intHao);
}
四向連通遞歸填充算法:
void BoundaryFill4(int x, int y, long FilledColor, long BoundaryColor)
{
long CurrentColor;
CurrentColor = GetPixelColor(x,y);
if (CurrentColor != BoundaryColor CurrentColor != FilledColor)
{
SetColor(FilledColor);
SetPixel (x,y);
BoundaryFill4(x+1, y, FilledColor, BoundaryColor);
BoundaryFill4(x-1, y, FilledColor, BoundaryColor);
BoundaryFill4(x, y+1, FilledColor, BoundaryColor);
BoundaryFill4(x, y-1, FilledColor, BoundaryColor);
}
}
該算法的優(yōu)點(diǎn)是非常簡(jiǎn)單,缺點(diǎn)是需要大量??臻g來(lái)存儲(chǔ)相鄰的點(diǎn)。