private static long getInstalledMemory()
        {
            //pad control set value in string with 3 chars

	    if(isWindows()){
		    //search registry key HKLM/HARDWARE/RESOURCEMAP/System Resources/Physical Memory for RAM amount
		    String regData = queryRegistry2("HKLM\\HARDWARE\\RESOURCEMAP\\System Resources\\Physical Memory",
			    ".Translated",
			    "REG_RESOURCE_LIST");

		    String count, iface, bus, ver, rev, unk, unk2, resType, disp, access, toss, base, length;
		    count = iface = bus = ver = rev = unk = unk2 = resType = disp = access = toss = base = length = null;
		    long ramTotal = 0;
		    if(regData != null){
			    //postOutput(" \n\n memory: \n" + regData + "\n");
			    //regData = removeSpaces(regData);
			    //regData = getOnlyNumeric(regData);
			    int idx=0;
			    count = regData.substring(idx,idx+8);
			    //postOutput("" + count + "\n");
			    idx +=8;
			    iface = regData.substring(idx,idx+8);
			    //postOutput("" + iface + "\n");
			    idx +=8;
			    bus = regData.substring(idx,idx+8);
			    //postOutput("" + bus + "\n");
			    idx +=8;
			    ver = regData.substring(idx,idx+4);
			    //postOutput("" + ver  + "\n");
			    idx +=4;
			    unk = regData.substring(idx,idx+4);
			    //postOutput("" + unk + "\n");
			    idx +=4;
			    unk2 = regData.substring(idx,idx+8);
			    //postOutput("" + unk2 + "\n");
			    idx +=8;
			    do{
				    resType = regData.substring(idx,idx+2);
				    //postOutput("" + resType + "\n");
				    idx +=2;
				    disp = regData.substring(idx,idx+2);
				    //postOutput("" + disp + "\n");
				    idx +=2;
				    access = regData.substring(idx,idx+2);
				    //postOutput("" + access + "\n");
				    idx +=2;
				    toss = regData.substring(idx,idx+2);
				    //postOutput("" + toss + "\n");
				    idx +=2;
				    base = regData.substring(idx,idx+16);
				    //postOutput("" + base + "\n");
				    
				    
				    idx +=16;
				    length = regData.substring(idx,idx+16);
				    //postOutput("" + length + "\n" );
				    long num = Long.parseLong(length,16);
				    //postOutput("This is long:=" + num + "\n");
				    long res = bigToLittleEndian(num);  
				    //postOutput("ram segment found: " +Long.toHexString(res) + " " + res/1024/1024 + "\n");
				    ramTotal += res;
				    idx +=16;
			    }
			    while(idx< regData.length());
	 
			    //postOutput("total ram: " + Long.toHexString(ramTotal) + " " + ramTotal/1024/1024 + "\n");
		    }
		    return ramTotal;
		}
		    else if(isLinux()){
			// cat /proc/meminfo | grep MemTotal
			File memFile = new File("/proc/meminfo");
			if(memFile.exists()){
			    String[] cmd = new String[2];
			    cmd[0] = "cat";
			    cmd[1] = "/proc/meminfo";

			    String ret = "";

			    String outputBuffer = callExternalProcess(cmd,true);  //TODO false

			    if(outputBuffer == null)
				return -1;

			    String[] outputLines = outputBuffer.split(System.getProperty("line.separator"));

			    String line;
			    boolean done = false;
			    int offset;

			    for(int i = 0; !done && i < outputLines.length; i++)   //for every output line
			    {
				line = outputLines[i];
				if(line.trim().startsWith("MemTotal"))
				{
				    //MemTotal: 32234234 kb
				    //TODO FIXME should use regex
				    ret = line.substring(9,(line.length()-3));
				    done = true;
				}
			    }
			    //TODO FIXME
			    //return Integer.parseInt(ret);
			    return 0;

			}

		    }


            return -1;         //unknown string found
        }