Skip to content

Instantly share code, notes, and snippets.

@xianlaioy
xianlaioy / DumpClassURL.java
Created June 10, 2017 15:34 — forked from rednaxelafx/DumpClassURL.java
Using the ProtectionDomain of an InstanceKlass to see where it was loaded from
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
public class DumpClassURL extends Tool {
public void run() {
@xianlaioy
xianlaioy / Fib.java
Created June 10, 2017 15:34 — forked from rednaxelafx/Fib.java
Yet another naive Fibonacci example
import java.util.*;
public class Fib {
static int o = 0;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long start = System.currentTimeMillis();
int answer = fib(n);