In this work, we study two types of constraints on two-dimensional binary arrays. Given p\in [0,1],\in [0,1/2] , we study 1) the p -bounded constraint: a binary vector of size n is said to be p -bounded if its weight is at most pn , and 2) the -balanced constraint: a binary vector of size n is said to be -balanced if its weight is within big [(1/2-)n, (1/2+)n\big]. Such constraints are crucial in several data storage systems, those regard the information data as two-dimensional (2D) instead of one-dimensional (1D), such as the crossbar resistive memory arrays and the holographic data storage. In this work, efficient encoding/decoding algorithms are presented for binary arrays so that the weight constraint (either p -bounded constraint or -b...