import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.m3g.Camera;
import javax.microedition.m3g.Graphics3D;
import javax.microedition.m3g.Loader;
import javax.microedition.m3g.World;
import javax.microedition.midlet.MIDlet;
public class RMMIDlet extends MIDlet implements CommandListener {
private Display myDisplay = null;
private RetainedCanvas myCanvas = null;
private Command exitCommand = new Command("Exit", Command.ITEM, 1);
public RMMIDlet() {
super();
myDi ......
import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfEncryptor;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfEncryptor
.encrypt(new PdfReader("1.pdf"), new FileOutputStream("Encrypted2.pdf"),
"Hello".getBytes(), "World".getBytes(), PdfWriter.AllowDegradedPrinting,
PdfWriter.STRENGTH128BITS);
// decrypt the file
PdfReader reader = new PdfReader("Encrypted2.pdf", "World".getBytes());
&nbs ......
import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfEncryptor;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfReader reader = new PdfReader("1.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("Encrypted1.pdf"));
stamper.setEncryption("Hello".getBytes(), "World".getBytes(), PdfWriter.AllowPrinting
| PdfWriter.AllowCopy, PdfWriter.STRENGTH40BITS);
stamper.close();
getEncryptionInformation("1.pdf", null);
getEncryptionInformation("Encrypted ......
import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfEncryptor;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfReader reader = new PdfReader("1.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("Encrypted1.pdf"));
stamper.setEncryption("Hello".getBytes(), "World".getBytes(), PdfWriter.AllowPrinting
| PdfWriter.AllowCopy, PdfWriter.STRENGTH40BITS);
stamper.close();
getEncryptionInformation("1.pdf", null);
getEncryptionInformation("Encrypted ......
class A {
public A(int x) {
}
}
class B {
public B(long x) {
}
}
class C {
public C(double x) {
}
}
public class Facade {
static A makeA(int x) {
return new A(x);
}
static B makeB(long x) {
return new B(x);
}
static C makeC(double x) {
return new C(x);
}
public static void main(String args[]) {
// The client programmer gets the objects by calling the static methods:
A a = Facade.makeA(1);
B b ......
public class BasicSingleton {
static Singleton s1 = null, s2 = null;
public static void main(String[] args) {
s1 = Singleton.getInstance();
s2 = Singleton.getInstance();
}
}
class Singleton {
private static Singleton mySingleton = null;
private Singleton() {
}
public static synchronized Singleton getInstance() {
if (null == mySingleton) {
mySingleton = new Singleton();
System.out.println(mySingleton.toString());
} else {
System.out.println(mySingleton.toString());
&n ......