Clasic Java code from ymp