/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class IntFrom0to1 {
public class InvalidValueException
extends Exception { public InvalidValueException
(String message
) { super(message);
}
}
int value;
public IntFrom0to1(int value) throws InvalidValueException {
if(value != 0 && value != 1)
throw new InvalidValueException("Value is out of range");
this.value = value;
}
}
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
try {
IntFrom0to1 a = new IntFrom0to1(0);
IntFrom0to1 b = new IntFrom0to1(2);
}
e.
printStackTrace(System.
out); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJbnRGcm9tMHRvMSB7CglwdWJsaWMgY2xhc3MgSW52YWxpZFZhbHVlRXhjZXB0aW9uIGV4dGVuZHMgRXhjZXB0aW9uIHsKCQlwdWJsaWMgSW52YWxpZFZhbHVlRXhjZXB0aW9uKFN0cmluZyBtZXNzYWdlKSB7CgkJCXN1cGVyKG1lc3NhZ2UpOwoJCX0KCX0KCglpbnQgdmFsdWU7CglwdWJsaWMgSW50RnJvbTB0bzEoaW50IHZhbHVlKSB0aHJvd3MgSW52YWxpZFZhbHVlRXhjZXB0aW9uIHsKCQlpZih2YWx1ZSAhPSAwICYmIHZhbHVlICE9IDEpCgkJCXRocm93IG5ldyBJbnZhbGlkVmFsdWVFeGNlcHRpb24oIlZhbHVlIGlzIG91dCBvZiByYW5nZSIpOwoJCXRoaXMudmFsdWUgPSB2YWx1ZTsKCX0KfQoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3d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