Skip to content

Instantly share code, notes, and snippets.

View uskey512's full-sized avatar
🍣
Focusing

Yusuke Uehara uskey512

🍣
Focusing
View GitHub Profile
connect-src 'self'
blob:
https://*.pscp.tv
https://*.twimg.com
https://*.video.pscp.tv
https://aa.twitter.com
https://aa.x.com
https://accounts.google.com/gsi/
https://ads-api.twitter.com
https://ads-api.x.com
@uskey512
uskey512 / RandomizedIntegerCache.java
Last active October 29, 2020 02:10
Integer.IntegerCacheを壊すテスト
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Random;
import sun.misc.Unsafe;
public class RandomizedIntegerCache {
public static void main(String[] args) {
for (int i = 1; i <= 10; ++i) {
Integer newValue = new Integer(i);
package main
import (
"fmt"
"os"
)
func main() {
v := os.Args[1]
class IntegerCompareBoundaryValueTest {
public static void main(String[] args) {
Integer a = 127;
Integer b = 127;
System.out.println(a == b);
a = 128;
b = 128;
System.out.println(a == b);
Classfile /Projects/gist/java/blog_integercache/IntegerCompare.class
Last modified 2019/12/22; size 583 bytes
SHA-256 checksum f65fb3e99ef730b1c8df6e1ccd7a1d68c9b2eeefdef036e6234cdd51ee11fcac
Compiled from "IntegerCompare.java"
class IntegerCompare
minor version: 0
major version: 57
flags: (0x0020) ACC_SUPER
this_class: #25 // IntegerCompare
super_class: #2 // java/lang/Object
class IntegerCompare {
public static void main(String[] args) {
Integer a = 100;
Integer b = 100;
System.out.println(a == b);
}
}
Classfile /Projects/gist/java/blog_integercache/IntCompare.class
Last modified 2019/12/22; size 493 bytes
SHA-256 checksum a4ee8895a66ef2c9b7395c1e5b354dc6efe95c1e0e3998d82ad60bea4f8cd580
Compiled from "IntCompare.java"
class IntCompare
minor version: 0
major version: 57
flags: (0x0020) ACC_SUPER
this_class: #19 // IntCompare
super_class: #2 // java/lang/Object
class IntCompare {
public static void main(String[] args) {
int a = 100;
int b = 100;
System.out.println(a == b);
}
}
class IntCompareTest {
public static void main(String[] args) {
int a = 100;
int b = 100;
System.out.println(a == b);
a = 200;
b = 200;
System.out.println(a == b);
}
}
class IntegerCompareTest {
public static void main(String[] args) {
Integer a = 100;
Integer b = 100;
System.out.println(a == b);
a = 200;
b = 200;
System.out.println(a == b);
}
}