真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

js代碼轉(zhuǎn)為JAVA代碼 js代碼轉(zhuǎn)php

js轉(zhuǎn)java代碼

package p1;

成都創(chuàng)新互聯(lián)是網(wǎng)站建設專家,致力于互聯(lián)網(wǎng)品牌建設與網(wǎng)絡營銷,專業(yè)領域包括做網(wǎng)站、成都網(wǎng)站建設、電商網(wǎng)站制作開發(fā)、小程序開發(fā)、微信營銷、系統(tǒng)平臺開發(fā),與其他網(wǎng)站設計及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結合了恒基網(wǎng)絡品牌建設經(jīng)驗和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結合,且不斷評估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!

import java.util.Arrays;

import java.util.LinkedList;

public class Guy

{

public static void recursionSub ( LinkedListint[] list, int count, int[] array, int ind, int start, int... indexs )

{

start++;

if (start count - 1)

{

return;

}

if (start == 0)

{

indexs = new int[array.length];

}

for ( indexs = ind; indexs array.length; indexs++ )

{

recursionSub (list, count, array, indexs + 1, start, indexs);

if (start == count - 1)

{

int[] temp = new int[count];

for ( int i = count - 1; i = 0; i-- )

{

temp[start - i] = array[indexs[start - i]];

}

list.add (temp);

}

}

}

public static void main ( String[] args )

{

int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

LinkedListint[] list = new LinkedListint[] ();

recursionSub (list, 3, array, 0, -1);

for ( int[] strings : list )

{

System.out.println (Arrays.toString (strings));

}

}

}

js代碼轉(zhuǎn)換為java

理解他的原理就好寫了。

所有參數(shù)?排除?時間戳,按照字母順序排序,然后連接起來?和?appKey?以及?appSercet?進行md5?運算。

排序可以使用?String?[]keys?=?map.keyset().toarray()?獲取后使用?Collections?進行sort。

有個類似的,可以參考一下:

public?static?boolean?signVerify(String?appSecret,MapString,?String?params){

MapString,?String?map=new?HashMapString,?String();

map.put("appSecret",?appSecret);

for(String?key:params.keySet()){

if(!key.equals("sign")){

map.put(key,?params.get(key));

}

}

String?sign=sign(map);

if(sign.equals(params.get("sign"))){

return?true;

}

return?false;

}

private?static?String?toHexValue(byte[]?messageDigest)?{

if?(messageDigest?==?null)

return?"";

StringBuilder?hexValue?=?new?StringBuilder();

for?(byte?aMessageDigest?:?messageDigest)?{

int?val?=?0xFF??aMessageDigest;

if?(val??16)?{

hexValue.append("0");

}

hexValue.append(Integer.toHexString(val));

}

return?hexValue.toString();

}

/**

?*?

?*?@param?params

?*?@return

?*/

public?static?String?sign(MapString,String?params){

ListString?keys=new?ArrayListString(params.keySet());

Collections.sort(keys);

String?string="";

for(String?s:keys){

string+=params.get(s);

}

String?sign="";

try?{

sign?=?toHexValue(encryptMD5(string.getBytes(Charset.forName("utf-8"))));

}?catch?(Exception?e)?{

e.printStackTrace();

throw?new?RuntimeException("md5?error");

}

return?sign;

}

private?static?byte[]?encryptMD5(byte[]?data)throws?Exception{

MessageDigest?md5?=?MessageDigest.getInstance("MD5");

md5.update(data);

return?md5.digest();

}

public?static?void?main(String[]?args)?{

String?appKey="key";

String?appSecret="secret";

MapString,?String?params=new?HashMapString,?String();

params.put("appKey",?appKey);

params.put("appSecret",?appSecret);

params.put("date",?new?Date().getTime()+"");

String?sign=sign(params);

params.put("sign",?sign);

System.out.println(signVerify(appSecret,?params));

}

一個js方法轉(zhuǎn)換為java代碼

package p1;

import java.util.Arrays;

import java.util.LinkedList;

public class Guy

{

public static void recursionSub ( LinkedListint[] list, int count, int[] array, int ind, int start, int... indexs )

{

start++;

if (start count - 1)

{

return;

}

if (start == 0)

{

indexs = new int[array.length];

}

for ( indexs = ind; indexs array.length; indexs++ )

{

recursionSub (list, count, array, indexs + 1, start, indexs);

if (start == count - 1)

{

int[] temp = new int[count];

for ( int i = count - 1; i = 0; i-- )

{

temp[start - i] = array[indexs[start - i]];

}

list.add (temp);

}

}

}

public static void main ( String[] args )

{

int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

LinkedListint[] list = new LinkedListint[] ();

recursionSub (list, 3, array, 0, -1);

for ( int[] strings : list )

{

System.out.println (Arrays.toString (strings));

}

}

}


名稱欄目:js代碼轉(zhuǎn)為JAVA代碼 js代碼轉(zhuǎn)php
分享網(wǎng)址:http://weahome.cn/article/doggchp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部