首页 \ 问答 \ JAVA手机游戏具体怎么安装

JAVA手机游戏具体怎么安装

对这方面不懂,可以将详细点吗。听懂后立即送分!现在就是手机上有个JAVA模拟器。还下了几个手机游戏是压缩包形式的,看过其他人的回答,可是没一个能听懂 把游戏压缩包解压后出来一大堆都不知道是什么东西?
更新时间:2022-08-16 07:08

最满意答案

md5加密:
package com.ncs.pki.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Test {
 private static MessageDigest digest = null;
 public synchronized static final String hash(String data) {
  if (digest == null) {
   try {
    digest = MessageDigest.getInstance("MD5");
   } catch (NoSuchAlgorithmException nsae) {
    System.err.println(
     "Failed to load the MD5 MessageDigest. "
      + "Jive will be unable to function normally.");
    nsae.printStackTrace();
   }
  }
  // Now, compute hash.
  digest.update(data.getBytes());
  return encodeHex(digest.digest());
 }
 public static final String encodeHex(byte[] bytes) {
  StringBuffer buf = new StringBuffer(bytes.length * 2);
  int i;

  for (i = 0; i < bytes.length; i++) {
   if (((int) bytes[i] & 0xff) < 0x10) {
    buf.append("0");
   }
   buf.append(Long.toString((int) bytes[i] & 0xff, 16));
  }
  return buf.toString();
 }
 public static String test(){
  return null;
 }
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  System.out.println(MD5Test.hash("123456"));
 }

}

3des加密:
package com.ncs.pki.util;

import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class DesEncrypt {
 /**
  * 
  * 使用DES加密与解密,可对byte[],String类型进行加密与解密 密文可使用String,byte[]存储.
  * 
  * 方法: void getKey(String strKey)从strKey的字条生成一个Key
  * 
  * String getEncString(String strMing)对strMing进行加密,返回String密文 String
  * getDesString(String strMi)对strMin进行解密,返回String明文
  * 
  *byte[] getEncCode(byte[] byteS)byte[]型的加密 byte[] getDesCode(byte[]
  * byteD)byte[]型的解密
  */

 Key key;

 /**
  * 根据参数生成KEY
  * 
  * @param strKey
  */
 public void getKey(String strKey) {
  try {
   KeyGenerator _generator = KeyGenerator.getInstance("DES");
   _generator.init(new SecureRandom(strKey.getBytes()));
   this.key = _generator.generateKey();
   _generator = null;
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 /**
  * 加密String明文输入,String密文输出
  * 
  * @param strMing
  * @return
  */
 public String getEncString(String strMing) {

  byte[] byteMi = null;
  byte[] byteMing = null;
  String strMi = "";
  BASE64Encoder base64en = new BASE64Encoder();
  try {
   byteMing = strMing.getBytes("UTF8");
   byteMi = this.getEncCode(byteMing);
   strMi = base64en.encode(byteMi);
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   base64en = null;
   byteMing = null;
   byteMi = null;
  }
  return strMi;
 }

 /**
  * 解密 以String密文输入,String明文输出
  * 
  * @param strMi
  * @return
  */
 public String getDesString(String strMi) {
  BASE64Decoder base64De = new BASE64Decoder();
  byte[] byteMing = null;
  byte[] byteMi = null;
  String strMing = "";
  try {
   byteMi = base64De.decodeBuffer(strMi);
   byteMing = this.getDesCode(byteMi);
   strMing = new String(byteMing, "UTF8");
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   base64De = null;
   byteMing = null;
   byteMi = null;
  }
  return strMing;
 }

 /**
  * 加密以byte[]明文输入,byte[]密文输出
  * 
  * @param byteS
  * @return
  */
 private byte[] getEncCode(byte[] byteS) {
  byte[] byteFina = null;
  Cipher cipher;
  try {
   cipher = Cipher.getInstance("DES");
   cipher.init(Cipher.ENCRYPT_MODE, key);
   byteFina = cipher.doFinal(byteS);
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   cipher = null;
  }
  return byteFina;
 }

 /**
  * 解密以byte[]密文输入,以byte[]明文输出
  * 
  * @param byteD
  * @return
  */
 private byte[] getDesCode(byte[] byteD) {
  Cipher cipher;
  byte[] byteFina = null;
  try {
   cipher = Cipher.getInstance("DES");
   cipher.init(Cipher.DECRYPT_MODE, key);
   byteFina = cipher.doFinal(byteD);
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   cipher = null;
  }
  return byteFina;
 }

 public static void main(String[] args) {
  System.out.println("des demo");
  DesEncrypt des = new DesEncrypt();// 实例化一个对像
  des.getKey("MYKEY");// 生成密匙
  System.out.println("key=MYKEY");
  String strEnc = des.getEncString("111111");// 加密字符串,返回String的密文
  System.out.println("密文=" + strEnc);
  String strDes = des.getDesString(strEnc);// 把String 类型的密文解密
  System.out.println("明文=" + strDes);
 }
}

其他回答

我用了半个小时帮你写了一个简单的验证用户名和密码登陆问题别辜负我的好意下面是代码!(建好包和类代码粘过去就能用)
实体类包entity
-------------------------------------------------------------
packageentity;
/**
*用户实体类
*@authornew
*
*/
publicclassusers{
privatestringname;//用户名
privatestringpass;//用户密码
/**
*空的构造函数用户实力化此类对象
*/
publicusers(){

}
/**
*构造函数接收用户名和密码
*@paramname
*@parampass
*/
publicusers(stringname,stringpass){

this.name=name;
this.pass=pass;
}
/**
*下面set和get方法就不用解释了吧
*@return
*/
publicstringgetname(){
returnname;
}
publicvoidsetname(stringname){
this.name=name;
}
publicstringgetpass(){
returnpass;
}
publicvoidsetpass(stringpass){
this.pass=pass;
}
}
数据库类包dao(我是模拟一下数据库没有用到数据库)
--------------------------------------------------------------
packagedao;

importjava.util.*;

importentity.users;//导入实体类

/**
*模拟数据库用户dao
*@authornew
*
*/
publicclassusersdao{
privatestaticusersusers=newusers();
static
{
users.setname("tom");
users.setpass("jerry");
}

/**
*根据姓名查找这个用户(模拟一下数据库)
*@paramname
*@return
*/
publicusersfinduserbyname(stringname)
{
if(name.equals(this.users.getname()))
{
returnthis.users;
}
returnnull;
}
}
业务类包service(验证用户名和密码)
------------------------------------------------------------
packageservice;
importdao.usersdao;

importentity.users;

/**
*验证密码业务类
*@authornew
*
*/
publicclassvalidatepass{
//实力化dao对象
privateusersdaous=newusersdao();
/**
*验证输入的密码是否正确
*@paramname
*@parampass
*@return
*/
publicusersvalidate(stringname,stringpass)
{
usersuser=null;
user=us.finduserbyname(name);
//如果不为空说明查到了
if(user!=null)
{
//用查询出来对象的密码和传过来的密码比较
if(user.getpass().equals(pass))
{
returnuser;
}
}
returnnull;
}
}
最后是测试test类包test
----------------------------------------------------------
packagetest;

importentity.users;
importservice.validatepass;

/**
*测试类
*@authornew
*
*/
publicclasstest{
/**
*main方法用于测试
*@paramargs
*/
publicstaticvoidmain(string[]args)
{
//实例化业务类对象
validatepassv=newvalidatepass();
//用户名和密码
stringname="tom";
stringpass="jerry";
//开始验证
usersuser=v.validate(name,pass);
if(user==null)
{
system.out.println("你输入的用户名或密码错误!");
}else
{
system.out.println("你已经通过验证,成功登陆!");
}

}
}
md5加密小例子:

import java.security.MessageDigest;

public class StringMD5 {
	private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5",
			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };

	/**
	 * 转换字节数组为16进制字串
	 * 
	 * @param b
	 *            字节数组
	 * @return 16进制字串
	 */

	public static String byteArrayToHexString(byte[] b) {
		StringBuffer resultSb = new StringBuffer();
		for (int i = 0; i < b.length; i++) {
			resultSb.append(byteToHexString(b[i]));
		}
		return resultSb.toString();
	}

	private static String byteToHexString(byte b) {
		int n = b;
		if (n < 0)
			n = 256 + n;
		int d1 = n / 16;
		int d2 = n % 16;
		return hexDigits[d1] + hexDigits[d2];
	}

	public static String MD5Encode(String origin) {
		String resultString = null;

		try {
			resultString = new String(origin);
			MessageDigest md = MessageDigest.getInstance("MD5");
			resultString = byteArrayToHexString(md.digest(resultString
					.getBytes()));
		} catch (Exception ex) {

		}
		return resultString;
	}
	public static void main(String[] args) {
		StringMD5 test = new StringMD5();
		String var = test.MD5Encode("123456");
		System.out.println(var);
	}
}

相关问答

更多
  • md5加密: package com.ncs.pki.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Test { private static MessageDigest digest = null; public synchronized static final String hash(String data) { if (digest == ...
  • 赶紧把代码看懂,我会问你代码的问题。
  • 这些东西早忘光了说下我的理解希望可以帮助你把。 1. 你先想好用什么来做,java swing里面做这个的,我记得这个东西可以直接用button来做的。 2. 这些button形成一个矩形,用一个数组来记录每个位置,比如point (x,y)这种。 3. 用一个map来存放每个位置上button的状态,比如用0表示是雷,1不是。2是已经显示空白的区域,最后可能就是map((x,y),1);这种。 4. 然后基本就是一些逻辑问题了,比如随机地雷位置(设置3里面随机数设置多少个是01).怎么右键点击显示周围雷个 ...
  • 这个就有点难度了,算法很多。只有可能在一些大论坛网站才能下到。毕竟斗地主开发还是要点含量的
  • mport java.awt.*; import javax.swing.*; import java.util.Random; import java.awt.event.*;
  • http://bbs.tech.ccidnet.com/read.php?tid=550351 你看看这个..也许你能满意!!!!
  • 服务器的: package liaotian; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.S ...
  • java源代码是用来关联jar中的编译代码的。 应用场景:通常在打开eclipse中的jar的时候,发现class文件不能被打开,此时出现下面的界面,此时就需要通过“Attach Source”,之后找到对应的java源代码来实现代码关联,即可正常的显示class类中的内容。 备注:如果此处ava源代码指的是源代码文件(“.java”),是用来进行代码维护和二次开发的必备东西。
  • 网上的源代码太少了

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)