public static List untieZipFile(String zipFile) throws FileNotFoundException, IOException{
List fileList = new ArrayList()
// ZIP文件输入流
ZipInputStream zinStream
try {
zinStream = new ZipInputStream(new FileInputStream(zipFile))
ZipEntry ze
// pathTemp 去掉.zip后缀 生成对应的释放文件夹
String pathTemp = zipFile.replaceAll("\\\\", "/").replaceAll("//","/").substring(0, zipFile.length() - 5)
// 如果有同名目录,删除原有目录下的文件
java.io.File oldFile = new File(pathTemp)
if (oldFile.exists()) {
deleteFileList(oldFile)
}
// 解压ZIP中全部文件
while ((ze = zinStream.getNextEntry()) != null) {
if(ze.getName().indexOf(".") != -1){
// fileTemp 获得ZIP中文件列表的路径
String[] fileTemp = ze.getName().replaceAll("\\\\", "/").replaceAll("//", "/").split("/")
// writeFile ZIP中单个文件的绝对路径
String writeFile = pathTemp
for (int i = 0i <fileTemp.length-1i++) {
writeFile = writeFile + "/" + fileTemp[i]
}
java.io.File newFile = new File(writeFile)
if (!newFile.exists()) {
newFile.mkdirs()
}
// 构造出与ZIP中路径相同的输出流
OutputStream zoutStream = new FileOutputStream(writeFile + "/" + fileTemp[fileTemp.length - 1])
// 写入文件内容
int bytesRead = 0
byte[] buffer = new byte[8192]
while ((bytesRead = zinStream.read(buffer, 0, 8192)) != -1) {
zoutStream.write(buffer, 0, bytesRead)
}
zoutStream.flush()
zoutStream.close()
fileList.add(writeFile + "/" + fileTemp[fileTemp.length - 1])
}
}
zinStream.close()
} catch (FileNotFoundException e) {
throw new FileNotFoundException(FileUtils.class.getName()+ "#untieZipFile()#" + e.getMessage())
} catch (IOException e) {
throw new IOException(FileUtils.class.getName()+ "#untieZipFile()#" + e.getMessage())
}
return fileList
}
//删除目录
public static void deleteFileList(File oldFile) {
if (oldFile != null || oldFile.exists() || oldFile.isDirectory()) {
File[] oldFileList = oldFile.listFiles()
if(oldFileList!=null){
for (int i = 0i <oldFileList.lengthi++) {
if (oldFileList[i].isFile()) {
oldFileList[i].delete()
} else if (oldFileList[i].isDirectory()) {
deleteFileList(oldFileList[i])
}
}
}
oldFile.delete()
}
}
用HALO 可以破解大多数用短信收费的JAVA游戏```操作很简单```用HALO 打开想要XX 的JAVA游戏
工具-配置-对JAVA进行破解 选上
再依次按下 F5 F6 F7就可以了
破解后的游戏保存在HALO 目录下的GAME 目录里
import java.util.*public class Test
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in)
int a
System.out.print("请输入正方形的边长:")
a=sc.nextInt()
for(int i=0i<ai++)
{
for(int j=0j<aj++)
{
if(0==i || a-1==i || 0==j || a-1==j)
{
System.out.print("*")
System.out.print(" ")
}
else
{
System.out.print(" ")
System.out.print(" ")
}
}
System.out.println()
}
sc.close()
}
}