Implementation of the X-means Clustering Algorithm for Wireless Sensor Networks