Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IncArray
- {
- private byte[] Arr = null;
- private int Length;
- public IncArray(int lengthArr)
- {
- Length = lengthArr;
- Arr = new byte[Length];
- }
- public bool Inc()
- {
- for (int i = Length - 1; i >= 0; i--)
- {
- if (Arr[i] < 255)
- {
- Arr[i]++;
- break;
- }
- else
- {
- Arr[i] = 0;
- if (i == 0) return false;
- }
- }
- return true;
- }
- public byte[] GetArray()
- {
- return Arr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement