public static void Write (String writemsg, String filename)
	{
		try //save to file
			{  
			FileConnection conn = (FileConnection)Connector.open(logFileName(filename),Connector.READ_WRITE);
			long x =0;
        	if (!conn.exists())
        		{                              
        			conn.create();        
        		} 
        	else
        		{
        		OutputStream out = conn.openOutputStream(x);
        		byte[] b = writemsg.getBytes();
				if(conn.canWrite())         
    				{                                             
					out.write(b);
    				}
				else
					{
					System.out.println("Cannot write to this file");
    				out.close();     
					}
        		}
			}
		catch(Exception io)
		{
		 System.out.println("exception" +io);
		}
        		}