switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_USHORT: return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: return new DataBufferInt(size, numBanks); default: throw new UnsupportedOperationException(); }
if (data == null) return createBuffer(dataType, size, 1);  return createBufferFromData(dataType, data, size);
  public static DataBuffer createBuffer(int dataType, int size, int numBanks)  {    switch (dataType)      {      case DataBuffer.TYPE_BYTE:	return new DataBufferByte(size, numBanks);      case DataBuffer.TYPE_USHORT:	return new DataBufferUShort(size, numBanks);      case DataBuffer.TYPE_INT:	return new DataBufferInt(size, numBanks);      default:	throw new UnsupportedOperationException();      }  }