public static StorageNodeMetadata getNode(int key){
        StorageNodeMetadata nodeMeta;
        
        int hashKey = key % moduloRange;
        
        if (storageNodes.isEmpty())
                return null;
        else
        {
            
            nodeMeta = null;            
            int diff = moduloRange;
            
            for (int i=0; i<storageNodes.size(); i++){
                StorageNodeMetadata node = storageNodes.get(i);
                int nodeId = node.getID();
                if ((nodeId > hashKey) && (nodeId - hashKey < diff))
                {
                    nodeMeta = node;
                    diff = nodeId - hashKey;
                }
            }
            
            if (nodeMeta == null)//when the key is store on the first node
                    {
                        //find the node with the smallest id
                        nodeMeta = storageNodes.get(0);
                        for (int i=1; i<storageNodes.size(); i++)
                            if (storageNodes.get(i).getID()< nodeMeta.getID())
                                nodeMeta = storageNodes.get(i);
                    }
            return nodeMeta;
        }
    }