> how to find RAM size of system by using java
That's platform dependant, so you can't do it directly in (pure) Java.
A possibility would be to call some native C/C++ code from Java using JNI:
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html
Good luck.
I don't think there is an API for that. Not all systems even necessarily have that information available to user processes (such as "Classic Unix" which doesn't have a system call for it.) On some multi-CPU architectures (NUMA, cluster, grid) the question might not even have an obvious answer.
Why do you need that? What are you trying to do?