code samples in c and java