Estimados:
Necesito ayuda de algun programador de java. Ya que necesito me ayude con un programa.
Necesito generar un .jar que muestre el resultado de este codigo.
Mi msn/email es:
[email protected]
package com.geodesic;
import java.util.Calendar;
import java.util.Date;
public class CreateCode
{
public static String GenerateKey(String Code)
{
String serialNumber= Code;
String ch;
int sum = 0;
int num = 0;
int iIndex=serialNumber.length();
while(iIndex>0)
{
ch=serialNumber.substring(iIndex - 1, iIndex);
ch.trim();
num=Integer.parseInt(ch);
sum = (sum+num)*2;
iIndex--;
}
String nu = String.valueOf(num);
sum = sum + 148392567;
serialNumber = "";
while(sum > 0)
{
num = sum % 10;
switch(num)
{
case 0:
serialNumber = serialNumber.concat("@");//.Append(L"@");
break;
case 1:
serialNumber = serialNumber.concat("#");//.Append(L"#");
break;
case 2:
serialNumber = serialNumber.concat("%");//.Append(L"%");
break;
case 3:
serialNumber = serialNumber.concat("^");//.Append(L"^");
break;
case 4:
serialNumber = serialNumber.concat("&");//.Append(L"&");
break;
case 5:
serialNumber = serialNumber.concat("*");//.Append(L"*");
break;
case 6:
serialNumber = serialNumber.concat("!");//.Append(L"!");
break;
case 7:
serialNumber = serialNumber.concat("?");//.Append(L"?");
break;
case 8:
serialNumber = serialNumber.concat("$");//.Append(L"$");
break;
case 9:
serialNumber = serialNumber.concat("a");//.Append(L"£");
break;
default:
serialNumber = serialNumber.concat(nu);//.Append(snum);
break;
}
sum = sum/10;
}
return serialNumber;
}
public static Calendar calendar = Calendar.getInstance();
public static String GetValue()
{
String dat = null, mon = null, yr = null, hor = null, min = null, sec = null;
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
int date = calendar.get(Calendar.DATE);
int hour = calendar.get(Calendar.HOUR);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
if( new Integer(date).toString().length() == 1)
{
dat = "0" + new Integer(date).toString();
}
else
{
dat = new Integer(date).toString();
}
if( new Integer(month).toString().length() == 1)
{
mon = "0" + new Integer(month).toString();
}
else
{
mon = new Integer(month).toString();
}
yr = new Integer(year).toString();
yr = yr.substring(2);
if( new Integer(hour).toString().length() == 1)
{
hor = "0" + new Integer(hour).toString();
}
else
{
hor = new Integer(hour).toString();
}
if( new Integer(minute).toString().length() == 1)
{
min = "0" + new Integer(minute).toString();
}
else
{
min = new Integer(minute).toString();
}
if( new Integer(second).toString().length() == 1)
{
sec = "0" + new Integer(second).toString();
}
else
{
sec = new Integer(second).toString();
}
String DATE = dat + mon + yr + hor + min + sec;
Runtime rt = Runtime.getRuntime();
String memory = new Integer((int)rt.freeMemory()).toString();
int len = memory.length();
memory = memory.substring(len-4);
String S = DATE + memory;
return S;
}
}