This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
/** | |
* reference link | |
* https://mp.weixin.qq.com/s/QS9e_lVxr5vuphql5O3xhA | |
* https://www.cnblogs.com/chenfei0801/archive/2013/04/06/3002146.html | |
* 对一个实现了Externalizable接口的类进行序列化及反序列化 | |
*/ | |
public class ExternalizableDemo1 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class KMP { | |
public static void main(String[] args) { | |
//Scanner sc = new Scanner(System.in); | |
//String str1 = sc.nextLine();//主串 | |
String str1 = "ababbabababbbab";//主串 | |
//while (sc.hasNext()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.crypto.KeyGenerator; | |
import javax.crypto.SecretKey; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.security.KeyStore; | |
import java.security.KeyStoreException; | |
import java.security.NoSuchAlgorithmException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.KeyFactory; | |
import java.security.KeyPair; | |
import java.security.KeyPairGenerator; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.spec.DSAPrivateKeySpec; | |
import java.security.spec.InvalidKeySpecException; | |
import javax.crypto.KeyGenerator; | |
import javax.crypto.SecretKey; | |
import javax.crypto.SecretKeyFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JosephusCircle { | |
public static void main(String[] args) { | |
int n = 0; | |
int m = 0; | |
int i = 0; | |
int s = 0; | |
Scanner scanner = new Scanner(System.in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.security.CodeSource; | |
import java.security.ProtectionDomain; | |
/** | |
* Creted on 2018/2/8. | |
*/ | |
public class TestGetClassFromWhichJarLocation { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo use function hello | |
hello() | |
{ | |
echo how many parameters in the function:$#; | |
echo what parameters in the function $@; | |
echo the name of this function is $0; | |
echo the first parameters is :$1; | |
echo the second parameters is :$2; | |
echo the second parameters is :$3; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* $Id$ | |
* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=/usr/bin/clang | |
NAME=im-select | |
INSTALL_PATH=/usr/local/bin/ | |
OPTS=-framework foundation -framework carbon | |
all: | |
$(CC) $(OPTS) -o $(NAME) $(NAME).m | |
install:$(NAME) | |
cp $(NAME) $(INSTALL_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClassGeneratorByJavassist { | |
public static void main(String[] args) throws Exception { | |
ClassPool pool = ClassPool.getDefault(); | |
//创建Programmer类 | |
CtClass cc= pool.makeClass("com.samples.Programmer"); | |
//定义code方法 | |
CtMethod method = CtNewMethod.make("public void code(){}", cc); | |
//插入方法代码 | |
method.insertBefore("System.out.println(\"I'm a Programmer,Just Coding.....\");"); |