You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
842 B
40 lines
842 B
3 years ago
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace EC.Utils.ConvertEx
|
||
|
{
|
||
|
public class CharHelper
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 10进制转换为二进制List
|
||
|
/// </summary>
|
||
|
/// <param name="value10"></param>
|
||
|
/// <returns></returns>
|
||
|
public static List<int> IntToBinaryList(int value10)
|
||
|
{
|
||
|
int curValue = value10;
|
||
|
List<int> binaryLIst = new List<int>();
|
||
|
while (curValue > 0)
|
||
|
{
|
||
|
binaryLIst.Add(curValue % 2);
|
||
|
curValue = curValue / 2;
|
||
|
}
|
||
|
return binaryLIst;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 列表倒序
|
||
|
/// </summary>
|
||
|
/// <param name="inList"></param>
|
||
|
/// <returns></returns>
|
||
|
public static List<int> ListReverse(List<int> inList)
|
||
|
{
|
||
|
List<int> binaryLIst = new List<int>();
|
||
|
int icount = inList.Count;
|
||
|
for (int x = icount - 1; x >= 0; x--)
|
||
|
{
|
||
|
binaryLIst.Add(inList[x]);
|
||
|
}
|
||
|
return binaryLIst;
|
||
|
}
|
||
|
}
|
||
|
}
|